<commit_before>require 'pry'
require 'net/http'
class ExperiencesController < ApplicationController
  include ExperiencesHelper

	def show
		@experience = Experience.find_by(id: params[:id])
	end

  def index
    if params[:user]
      @experiences = Experience.includes(:dishes).where(user_id: params[:user])
    elsif params[:search]
      @experiences = ExperiencesHelper.get_search_results(params[:search])
    else
      @experiences = Experience.includes(:dishes).all
    end
  end

  def new
    @experience = Experience.new
    @venue = Venue.new
    @experience.dishes.build
  end

  def create
    @venue = Venue.create_venue(params[:place_id])
    @experience = current_user.experiences.build(name: experience_params[:name])
    @dish = @experience.dishes.build(experience_params[:dish])
    @dish.venue = @venue
    if @venue.save && @experience.save && @dish.save
      redirect_to experiences_path
    else
      render :new
    end
  end

  def search
    redirect_to :action => "index", :search => params[:search]
  end

  def edit
    @experience = Experience.find_by(id: params[:id])
  end

  def update
    @experience = Experience.find_by(id: params[:id])
    if @experience.update_attributes(name: experience_params[:name])
      redirect_to experience_path(@experience)
    else
      render :edit
    end
  end

  def destroy
    @experience = Experience.find_by(id: params[:id])
    @experience.destroy
    redirect_to experiences_path
  end<commit_msg>update_attibutes to update<commit_after>require 'pry'
require 'net/http'
class ExperiencesController < ApplicationController
  include ExperiencesHelper

	def show
		@experience = Experience.find_by(id: params[:id])
	end

  def index
    if params[:user]
      @experiences = Experience.includes(:dishes).where(user_id: params[:user])
    elsif params[:search]
      @experiences = ExperiencesHelper.get_search_results(params[:search])
    else
      @experiences = Experience.includes(:dishes).all
    end
  end

  def new
    @experience = Experience.new
    @venue = Venue.new
    @experience.dishes.build
  end

  def create
    @venue = Venue.create_venue(params[:place_id])
    @experience = current_user.experiences.build(name: experience_params[:name])
    @dish = @experience.dishes.build(experience_params[:dish])
    @dish.venue = @venue
    if @venue.save && @experience.save && @dish.save
      redirect_to experiences_path
    else
      render :new
    end
  end

  def search
    redirect_to :action => "index", :search => params[:search]
  end

  def edit
    @experience = Experience.find_by(id: params[:id])
  end

  def update
    @experience = Experience.find_by(id: params[:id])
    if @experience.update(name: experience_params[:name])
      redirect_to experience_path(@experience)
    else
      render :edit
    end
  end

  def destroy
    @experience = Experience.find_by(id: params[:id])
    @experience.destroy
    redirect_to experiences_path
  end
{'fraction_non_alphanumeric': 0.10622462787550745, 'fraction_numerical': 0.0, 'mean_word_length': 3.642072213500785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '964004', 'n_tokens_mistral': 933, 'n_tokens_neox': 888, 'n_words': 199}