<commit_before>class ListingController < ApplicationController
  before_action :authenticate_user!, except: [:index, :details]

  def index
    @listings = Listing.all
  end

  def new
    @listing = Listing.new
  end

  def create
    new_listing = Listing.new
    new_listing.title =  params[:listing][:title]
    new_listing.description = params[:listing][:description]
    new_listing.user = current_user

    if new_listing.save
      redirect_to listing_index_path, notice: 'Annonsen din er publisert'
    else
      @listing = new_listing
      redirect_to new_listing, notice: 'Det var en feil med annonsen din'
    end
  end

  def delete
  end
<commit_msg>:art: [listing#create] make creation of object more compact<commit_after>class ListingController < ApplicationController
  before_action :authenticate_user!, except: [:index, :details]

  def index
    @listings = Listing.all
  end

  def new
    @listing = Listing.new
  end

  def create
    new_listing = Listing.new(params[:listing])
    new_listing.user = current_user

    if new_listing.save
      redirect_to listing_index_path, notice: 'Annonsen din er publisert'
    else
      @listing = new_listing
      redirect_to new_listing, notice: 'Det var en feil med annonsen din'
    end
  end

  def delete
  end

{'fraction_non_alphanumeric': 0.07315175097276265, 'fraction_numerical': 0.0, 'mean_word_length': 3.480836236933798, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5984997', 'n_tokens_mistral': 429, 'n_tokens_neox': 392, 'n_words': 113}