Having an issue with devise. I have a sign up url that includes a token...something like: localhost:3000/users/sign_up/df293b00ae137b8b6436d45e622304aedc549072
When registration fails (passwords dont match or something) the app redirects to localhost:3000/users and displays the right flash messages from the model.
However I need the app to redirect back to the url with the token. So I throw redirect_to :back in the controller which takes me back but the flash messages dont show up.
How to I make the page redirect back (retain the exact url) and still show the flash messages.
Here is the code from the devise controller:
def new
resource = build_resource({})
respond_with resource
end
# POST /resource
def create
build_resource
if resource.save
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_navigational_format?
sign_up(resource_name, resource)
respond_with resource, :location => after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
expire_session_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
Any help would be great!
flash.keepbeforeredirect_to :back? It sounds like the Flash isn't surviving the redirect. - Peter Mellett