I have a single secure payment page at secure.website.com. Using devise to sign out on that specific page, signing out breaks saying there’s no user with id=sign_out. I am guessing this is because when i’m on the secure page, all the links on that page also have secure.website.com/users/sign_out (for example).
rather than always specifying that I want to use www as the url in my link_to…i want to set it to default to that. I tried doing default_url_options but that didn’t seem to work. How do I make sure all links are always www subdomain unless otherwise specified?
lastly, what i’ve been doing to guarantee a page is www unless on the secure page is this:
def always_use_www
if params[:controller] != 'subscriptions' && request.subdomain != 'www'
redirect_to :subdomain => "www"
end
end
i put this in the application controller as a before filter. this seems like a really poor way of doing it. is there a ‘right’ way? I only want that one secure page to have a different subdomain…otherwise always use www.
You can create a method
default_url_options:You can put this method in application controller of the subcontrollers. To the best of my knowledge, you can only set the whole host, not subdomain. In general, you can put any option
url_forsupports in this method.