Rebuild rubocop TODOs after auto-correcting

This commit is contained in:
James Mason 2018-04-04 10:18:51 -07:00
parent 31c50255e9
commit 84dbb52d11
No known key found for this signature in database
GPG key ID: 1B3951886C449023
580 changed files with 3689 additions and 3133 deletions

View file

@ -1,8 +1,10 @@
# frozen_string_literal: true
class ConferenceRegistrationsController < ApplicationController
before_action :authenticate_user!, except: [:new, :create]
before_action :authenticate_user!, except: %i[new create]
load_resource :conference, find_by: :short_title
authorize_resource :conference_registrations, class: Registration, except: [:new, :create]
before_action :set_registration, only: [:edit, :update, :destroy, :show]
authorize_resource :conference_registrations, class: Registration, except: %i[new create]
before_action :set_registration, only: %i[edit update destroy show]
def new
@registration = Registration.new(conference_id: @conference.id)
@ -54,9 +56,7 @@ class ConferenceRegistrationsController < ApplicationController
ahoy.track 'Registered', title: 'New registration'
# Sign in the new user
unless current_user
sign_in(@registration.user)
end
sign_in(@registration.user) unless current_user
if @conference.tickets.any? && !current_user.supports?(@conference)
redirect_to conference_tickets_path(@conference.short_title),
@ -73,7 +73,7 @@ class ConferenceRegistrationsController < ApplicationController
end
def update
if @registration.update_attributes(registration_params)
if @registration.update(registration_params)
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'Registration was successfully updated.'
else
@ -110,14 +110,15 @@ class ConferenceRegistrationsController < ApplicationController
def registration_params
params.require(:registration)
.permit(
:conference_id, :arrival, :departure,
:volunteer,
vchoice_ids: [], qanswer_ids: [],
qanswers_attributes: [],
event_ids: [],
user_attributes: [
:username, :email, :name, :password, :password_confirmation]
)
.permit(
:conference_id, :arrival, :departure,
:volunteer,
vchoice_ids: [], qanswer_ids: [],
qanswers_attributes: [],
event_ids: [],
user_attributes: %i[
username email name password password_confirmation
]
)
end
end