Reputation: 1364
The situation is the following, using Devise and Rails 3
After successfully submitting the signup form, Devise logs her in, redirects (to the home page in my case) and shows a custom message (in application_controller.rb)
def after_sign_in_path_for(resource_or_scope)
flash[:notice] = "Hi " + current_user.username + " , you're now signed in."
super
end
The user tries then to sign up again. In this case the sigup form is not displayed, the user is redirected to the homepage and the same message is displayed.
How do I set up different messages in the two cases above?
Upvotes: 2
Views: 992
Reputation: 1364
Ok, I figured out the followings:
This behaviour is caused by the registration controller, which has a prepend_before_filter that triggers a call to require_no_authentication. Require_no_authentication simply redirects to root_url if the user is logged in
There is an open ticket on github, since it's quite difficult to override the method (see here: Devise issues
Nevertheless, as pointed out by Jose' Valim on the same page, it doesn't make much sense to show to a logged in user the sign up link... I'll modify the interface of my application to hide the signup link if the user is logged in.
Upvotes: 1