<commit_before>class AttractionsController < ApplicationController
  before_action :set_attractions
  before_action :set_attraction, only: [:show, :edit, :update, :destroy]

  # GET vacations/1/attractions
  def index
    @attractions = @vacation.attractions
  end

  # GET vacations/1/attractions/1
  def show
  end

  # GET vacations/1/attractions/new
  def new
    @attraction = @vacation.attractions.build
  end

  # GET vacations/1/attractions/1/edit
  def edit
  end

  # POST vacations/1/attractions
  def create
    @attraction = @vacation.attractions.build(attraction_params)

    if @attraction.save
      redirect_to(vacation_attractions_path, notice: 'Attraction was successfully created.')
    else
      render action: 'new'
    end
  end

  # PUT vacations/1/attractions/1
  def update
    if @attraction.update_attributes(attraction_params)
      redirect_to([@attraction.vacation, @attraction], notice: 'Attraction was successfully updated.')
    else
      render action: 'edit'
    end
  end

  # DELETE vacations/1/attractions/1
  def destroy
    @attraction.destroy

    redirect_to vacation_attractions_url(@vacation)
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_attractions
      @vacation = Vacation.find(params[:vacation_id])
    end

    def set_attraction
      @attraction = @vacation.attractions.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.<commit_msg>Update attraction edit to redirect to index<commit_after>class AttractionsController < ApplicationController
  before_action :set_attractions
  before_action :set_attraction, only: [:show, :edit, :update, :destroy]

  # GET vacations/1/attractions
  def index
    @attractions = @vacation.attractions
  end

  # GET vacations/1/attractions/1
  def show
  end

  # GET vacations/1/attractions/new
  def new
    @attraction = @vacation.attractions.build
  end

  # GET vacations/1/attractions/1/edit
  def edit
  end

  # POST vacations/1/attractions
  def create
    @attraction = @vacation.attractions.build(attraction_params)

    if @attraction.save
      redirect_to(vacation_attractions_path, notice: 'Attraction was successfully created.')
    else
      render action: 'new'
    end
  end

  # PUT vacations/1/attractions/1
  def update
    if @attraction.update_attributes(attraction_params)
      redirect_to(vacation_attractions_path, notice: 'Attraction was successfully updated.')
    else
      render action: 'edit'
    end
  end

  # DELETE vacations/1/attractions/1
  def destroy
    @attraction.destroy

    redirect_to vacation_attractions_url(@vacation)
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_attractions
      @vacation = Vacation.find(params[:vacation_id])
    end

    def set_attraction
      @attraction = @vacation.attractions.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
{'fraction_non_alphanumeric': 0.07919463087248323, 'fraction_numerical': 0.00738255033557047, 'mean_word_length': 3.537290715372907, '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': '4811204', 'n_tokens_mistral': 986, 'n_tokens_neox': 904, 'n_words': 228}