<commit_before>class EventsController < ApplicationController
  before_action :authenticate_user!, only: [:new, :create]

  def new
    @event = current_user.managed_events.build
  end

  def create
    @event = current_user.managed_events.build(event_params)
    if @event.save
      flash[:success] = "Your event was created!"
      redirect_to dashboard_path
    else
      render 'new'
    end
  end

  private

    def event_params
      params.require(:event).permit(:title, :description, :location)
    end
end<commit_msg>updated controller actions<commit_after>class EventsController < ApplicationController
  before_action :authenticate_user!, only: [:new, :create, :edit]

  def new
    @event = current_user.managed_events.build
  end

  def create
    @event = current_user.managed_events.build(event_params)
    if @event.save
      flash[:success] = "Your event was created!"
      redirect_to dashboard_path
    else
      render 'new'
    end
  end

  def edit
    @event = Event.find(params[:id])
  end

  def update
    @event = Event.find(params[:id])
    if @event.update(event_params)
      flash[:success] = "Your event was updated!"
      redirect_to dashboard_path
    else
      render 'edit'
    end
  end

  private

    def event_params
      params.require(:event).permit(:title, :description, :location)
    end
end
{'fraction_non_alphanumeric': 0.09144981412639405, 'fraction_numerical': 0.0, 'mean_word_length': 3.273015873015873, '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': '7540264', 'n_tokens_mistral': 416, 'n_tokens_neox': 398, 'n_words': 103}