Fix assignment with if

This commit is contained in:
Hernan Schmidt 2017-07-12 17:05:48 +02:00
parent 9b362db98e
commit 60569d5ec0
5 changed files with 31 additions and 31 deletions

View file

@ -38,12 +38,12 @@ class ConferenceRegistrationsController < ApplicationController
def create
@registration = @conference.registrations.new(registration_params)
if current_user.nil?
# @user variable needs to be set so that _sign_up_form_embedded works properly
@user = @registration.build_user(user_params)
else
@user = current_user
end
@user = if current_user.nil?
# @user variable needs to be set so that _sign_up_form_embedded works properly
@registration.build_user(user_params)
else
current_user
end
@registration.user = @user
authorize! :create, @registration