I have a Rails 3 project with Devise, confirmable enabled so the user has to confirm their account through email after registration. Currently the project returns the user t
I'm just putting @Shannon's comment into an answer to make it easier to find.
If you are requiring email confirmation after sign-up, your user will be left in an in-between state where they have signed up but not clicked the link emailed to them to confirm their account. This is an inactive sign up. To redirect in this situation you need to specify:
def after_inactive_sign_up_path_for(resource)
"http://example.com"
end
Which version of devise are you using? I'm pretty sure that this issue was recently resolved so you probably need the latest version from the repo which is still a release candidate (although it should be out soon as they were waiting for omniauth 0.2 to get out of beta which recently happened).
I am using Devise 1.2.rc2 from the github repo with rails 3.0.5. I added the code that you mentioned to my custom RegistrationsController and was forwarded to google as expected after creating a new account.
A cutdown version of my RegistrationsController (in app/controllers/users)
class Users::RegistrationsController < Devise::RegistrationsController
protected
def after_sign_up_path_for(resource)
"http://google.com"
end
end
My routes.rb entry
devise_for :users, :controllers => { :registrations => "users/registrations" }
From my Gemfile
gem 'devise', :git => "git://github.com/plataformatec/devise.git"
Let me know if you're having problems on the latest version of devise.
Another way would be to do this in application controller
def after_sign_in_path_for(resource)
resource.sign_in_count <= 1 ? '/edit_profile' : root_path
end