In create
action, swap
respond_with resource, :location => after_sign_up_path_for(resource)
if params[:user][:role] == "Proof"
Proof.create(:user_id => current_user.id, :first_name => params[:user][:first_name], :last_name => params[:user][:last_name])
end
To
if params[:user][:role] == "Proof"
Proof.create(:user_id => current_user.id, :first_name => params[:user][:first_name], :last_name => params[:user][:last_name])
end
respond_with resource, :location => after_sign_up_path_for(resource)
Currently, Proof
record is not getting created as the code from if
statement is dead code and is never executed. The method create
returns when you call respond_with
method.
Executing the if
statement before respond_with
call should resolve your issue.
UPDATE
As per the chat session with OP, the Proof
record was not getting created because of a validation on custom_url
field. Suggested to change the validation with on: :update
option.
validates :custom_url, uniqueness: true, on: :update