I am using devise gem in a rails application with multiple subdomains. Each subdomain is handled by respective controller, which look like this:
class Subdomain1Controller < ApplicationController
before_filter :authenticate_user!
def index
end
end
With above controller implementation, Devise always keep subdomain while redirecting user to login page. In above case, Devise redirect user to http://subdomain1.acmesite/users/sign_in instead of a common sign_in Url.
This leads to having multiple sign_in urls for each sub-domains.
http://subdomain1.acmesite/users/sign_in
http://subdomain2.acmesite/users/sign_in
http://subdomain3.acmesite/users/sign_in
I am wondering if it's possible to override devise method to exclude subdomain part from the url and yet keeping the previous page url information. More preciously, I wants Devise to redirect user to a specific Url (like: http://acmesite/users/sign_in) irrespective of subdomain and after successful authentication, Devise should return user back to the caller subdomain+page.