make @user definition more clear
This commit is contained in:
parent
30831ce718
commit
2b433a9cbe
1 changed files with 11 additions and 1 deletions
|
|
@ -21,6 +21,8 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@registration = Registration.new
|
@registration = Registration.new
|
||||||
|
|
||||||
|
# @user variable needs to be set so that _sign_up_form_embedded works properly
|
||||||
@user = @registration.build_user
|
@user = @registration.build_user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -34,7 +36,15 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@registration = @conference.registrations.new(registration_params)
|
@registration = @conference.registrations.new(registration_params)
|
||||||
@registration.user = current_user || ( @user = @registration.build_user(user_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
|
||||||
|
|
||||||
|
@registration.user = @user
|
||||||
|
|
||||||
if @registration.save
|
if @registration.save
|
||||||
# Trigger ahoy event
|
# Trigger ahoy event
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue