<commit_before>class EventRegistrationsController < OrganizationController
  before_filter :verification_required
  load_and_authorize_resource :event
  load_and_authorize_resource through: :event, except: [:new]
  # GET /event_registrations/1
  # GET /event_registrations/1.json
  def show
    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @event_registration }
    end
  end

  # GET /event_registrations/new
  # GET /event_registrations/new.json
  def new
    @event_registration = @event.event_registrations.new(user: current_user)

    respond_to do |format|
      format.html # new.html.erb
    end
  end

  # GET /event_registrations/1/edit
  def edit
  end

  # POST /event_registrations
  # POST /event_registrations.json
  def create
    @event_registration.user = current_user

    respond_to do |format|
      if @event_registration.save
        format.html { redirect_to event_path(@event), notice: "You have registered for #{@event.title}." }
      else
        format.html { render action: "new" }
      end
    end
  end

  # PUT /event_registrations/1
  # PUT /event_registrations/1.json
  def update
    respond_to do |format|
      if @event_registration.update_attributes(params[:event_registration])
        format.html { redirect_to @event_registration, notice: 'Event registration was successfully updated.' }
      else
        format.html { render action: "edit" }
      end
    end
  end

  # DELETE /event_registrations/1<commit_msg>Authorize better<commit_after>class EventRegistrationsController < OrganizationController
  before_filter :verification_required
  load_and_authorize_resource :event
  load_and_authorize_resource through: :event, except: [:new, :create]
  # GET /event_registrations/1
  # GET /event_registrations/1.json
  def show
    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @event_registration }
    end
  end

  # GET /event_registrations/new
  # GET /event_registrations/new.json
  def new
    authorize! :create, @event.event_registrations.new
    @event_registration = @event.event_registrations.new(user: current_user)

    respond_to do |format|
      format.html # new.html.erb
    end
  end

  # GET /event_registrations/1/edit
  def edit
  end

  # POST /event_registrations
  # POST /event_registrations.json
  def create
    authorize! :create, @event.event_registrations.new
    @event_registration = @event.event_registrations.create(params[:event_registration].merge(user: current_user))

    respond_to do |format|
      if @event_registration.save
        format.html { redirect_to event_path(@event), notice: "You have registered for #{@event.title}." }
      else
        format.html { render action: "new" }
      end
    end
  end

  # PUT /event_registrations/1
  # PUT /event_registrations/1.json
  def update
    respond_to do |format|
      if @event_registration.update_attributes(params[:event_registration])
        format.html { redirect_to @event_registration, notice: 'Event registration was successfully updated.' }
      else
        format.html { render action: "edit" }
      end
    end
  end

  # DELETE /event_registrations/1
{'fraction_non_alphanumeric': 0.08528584817244611, 'fraction_numerical': 0.0037488284910965324, 'mean_word_length': 3.362397820163488, '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': '1881533', 'n_tokens_mistral': 1025, 'n_tokens_neox': 991, 'n_words': 228}