Skip to content

Commit

Permalink
Fix Devise signup/redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
negomi committed Jan 7, 2014
1 parent 56e54fd commit 3061ac8
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@ class UsersController < Devise::RegistrationsController
before_filter :authenticate_user!

def create
user = User.create(params[:user])
user.lists.create(name: "kindergarten")
user.lists.create(name: "school")
user.lists.create(name: "graduated")
redirect_to user_lists_path(current_user.id)
build_resource(sign_up_params)

if resource.save
yield resource if block_given?
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_format?
sign_up(resource_name, resource)
resource.lists.create(name: "kindergarten")
resource.lists.create(name: "school")
resource.lists.create(name: "graduated")
redirect_to user_lists_path(current_user.id)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
expire_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
end

0 comments on commit 3061ac8

Please sign in to comment.