Created
November 25, 2014 19:17
-
-
Save hubertlepicki/8bd087a56c93594a23ce to your computer and use it in GitHub Desktop.
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 | |
session[:user_account_params].stringify_keys!.merge!(params[:user_account]) if params[:user_account] | |
session[:user_account_params]["browser_locales"] = request.env['HTTP_ACCEPT_LANGUAGE'] | |
@user_account = UserAccount.new(session[:user_account_params]) | |
@user_account.current_step = session[:user_account_step] | |
if @user_account.valid? | |
if params[:back_button] | |
@user_account.previous_step | |
elsif @user_account.last_step? | |
@user_account.save if @user_account.all_valid? | |
else | |
@user_account.next_step | |
end | |
session[:user_account_step] = @user_account.current_step | |
end | |
if @user_account.new_record? | |
render 'new' | |
else | |
session[:user_account_step] = session[:user_account_params] = nil | |
auto_login(User.find(@user_account.id)) | |
redirect_to "/", notice: I18n.t("registration.success") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment