Trouble with setting custom controller redirect for devise
I'm having trouble setting Devise properly with my controllers. I've tried quite some things but nothing seems to work. Please do not redirect me to the wiki, i know about it, have tried things without success.
In my current situation, after login the user is redirected properly, but after sign up, it seems that current_user is not available开发者_JAVA技巧.
So, my question is :
If i have a controller named Town, how can i redirect devise to that controller after successful login and successful signup ?
EDIT :
there seems to be some kind of messing with the controllers. Some times, i get errors like :
No route matches {:action=>"monster_attack", :controller=>"user/tavern"}
although user/tavern is never specified, when i login sometimes, i get that redirection. If i specify it like :controller => '/tavern', it works ok. Any ideas ?
Well normally the following works for me. Given you are in Rails 3 you are working with a Devise Model called "User", you could do something like this in your routes.rb file:
devise_for :users
namespace :user do
root :to => "town#show"
end
Hope that helps.
精彩评论