<commit_before>class Admin::VenuesController < AdminController

  before_action :find_venue, only: [:edit, :update]

  def create
    @venue = Venue.create(venue_params)

    if @venue.persisted?
      redirect_to admin_venues_path, notice: 'Lugar creado con éxito.'
    else
      flash[:error] = @venue.humanized_errors
      render :new
    end
  end

  def index
    @venues = Venue.all
  end

  def new
    @venue = Venue.new
  end

  def edit
  end

  def update
    if @venue.update(venue_params)
      redirect_to admin_venues_path, notice: 'Lugar fue actualizado con éxito.'
    else
      render :edit
    end
  end

  def destroy
    if Venue.destroy(params[:id])
      redirect_to admin_venues_path, notice: 'Lugar destruído con éxito.'
    else
      redirect_to admin_venues_path, error: 'Lugar no pudo ser destruído.'
    end
  end

  private

  def find_venue
    @venue = Venue.find(params[:id])<commit_msg>Eager load location on venues list<commit_after>class Admin::VenuesController < AdminController

  before_action :find_venue, only: [:edit, :update]

  def create
    @venue = Venue.create(venue_params)

    if @venue.persisted?
      redirect_to admin_venues_path, notice: 'Lugar creado con éxito.'
    else
      flash[:error] = @venue.humanized_errors
      render :new
    end
  end

  def index
    @venues = Venue.includes(:location).all
  end

  def new
    @venue = Venue.new
  end

  def edit
  end

  def update
    if @venue.update(venue_params)
      redirect_to admin_venues_path, notice: 'Lugar fue actualizado con éxito.'
    else
      render :edit
    end
  end

  def destroy
    if Venue.destroy(params[:id])
      redirect_to admin_venues_path, notice: 'Lugar destruído con éxito.'
    else
      redirect_to admin_venues_path, error: 'Lugar no pudo ser destruído.'
    end
  end

  private

  def find_venue
    @venue = Venue.find(params[:id])
{'fraction_non_alphanumeric': 0.08046585494970884, 'fraction_numerical': 0.0, 'mean_word_length': 2.9457202505219207, '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': '6259648', 'n_tokens_mistral': 656, 'n_tokens_neox': 634, 'n_words': 174}