Reputation: 10208
My root page is a welcome page that has a link that opens a sign up modal.
I have specific pages that needs authentication. When I go to that specific page I am redirected to localhost:3000/users/sign_in. But I want to redirect the user to my home page and show the modal. I mean that I want the sign in page to be localhost:3000/ and somehow , just in that case passing a parameter that allows me to know that I have to open the popup.
I mean, When I go to localhost:3000 I should just show the home screen.
But If I go to localhost:3000/myspecificpagewithauthentication I should be redirected to localhost:3000?showsignup=true (in order to be able to show the modal using JS) and after sign up I should be redirected again to localhost:3000/myspecificpagewithauthentication (already authenticated).
I am using Devise and RoR 3.
Any help? Thanks.
Upvotes: 1
Views: 535
Reputation: 2013
devise is a well documented gem. here you go
update:
to change after sign in path, write your own after_sign_in_path_for method to application controller. This will override devise's method.
class ApplicationController < ActionController::Base
def after_sign_in_path_for(resource)
your_custom_path
end
end
Upvotes: 4