I have a Rails 3 app that uses Devise. How do I go about changing devise’s root controller to something other than the application’s root controller.
In my routes.rb file, I have the applications root set as root :to => 'home#index' so http://app.com/users/sign_in will call up the devise form which is not what I want.
I also have the following in routes.rb (this is the route that I want devise to use):
scope :module => 'control' do
constraints :subdomain => 'control' do
resources :offers
root :to => 'offers#index'
end
end
How can I point devise to use the above path (control.app.com) so that the user sign in would be located at http://control.app.com/users/sign_in?
Thanks!
Tim
I’ve found the solution. I added
devise_forinside the scope as so:You need to add
:module => 'devise'because the module is changed to the namespace’s name, so you have to set it back to ‘devise’. Now I can access all the devise actions with thecontrolsubdomain (ex. control.app.com/users/sign_in, control.app.com/users/sign_up, etc)