Last active
December 30, 2015 07:49
-
-
Save mrageh/7798453 to your computer and use it in GitHub Desktop.
users controller lol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@user = User.new(user_params) | |
if @user.save && current_order.id | |
session[:user_id] = @user.id | |
current_order.update_attributes(:user_id => @user.id) # new line | |
current_order.save | |
redirect_to order_path(current_order.id), :notice => "Signed up!" | |
elsif @user.save && !current_order.id | |
session[:user_id] = @user.id | |
redirect_to menu_path | |
else | |
render "sessions/new" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment