Devise current_user after sign up redirects to my own controller?
i'm using devise as an authentication ge开发者_Python百科m. Sign in works fine after it redirects to town#index through :
namespace :user do
root :to => "town#index"
end
However, when i first sign up a user, it seems that current_user is not passed to the town controller and i get and error. Why is that happening ? Is there a way to fix ?
It's not clear from your question, so I'll assume that you're creating User
instances yourself.
After signing up a new user, you need to call sign_in @user
or current_user
will stay nil
.
精彩评论