newbie_86
newbie_86

Reputation: 4610

redirect to specific page with devise and rails 3

How do i redirect to a specific page on successful login and successful registration?

I tried this in my routes file but it still redirects to user/login

namespace :user do
    root :to => "welcome#index"
end

tried the devise wiki how-tos but no success...

edit: using devise 1.1.rc1 and rails 3.0.5

Upvotes: 2

Views: 1178

Answers (1)

Syed Aslam
Syed Aslam

Reputation: 8807

You can override after_sign_in_path_for to redirect to specific location after sign_in using Devise.

Try this in your application_controller.rb

def after_sign_in_path_for(resource_or_scope)
   dashboard_path
end

Where dashboard_path might be the path you want to redirect the user to after sign_in.

Upvotes: 4

Related Questions