I have an application that can be accessed from two different URLs, and it looks / behaves a little differently, depending on which URL you use to access it. I can do this by storing the value in the session object and defining some of its solutions, for example, from which the paths are loaded.
This approach looked as if it would work until I needed to have another URL sent in emails. In a class that inherits from ActionMailer, I need to set default_url_options [: host] based on the value of the session variable. Rails raises the following error when I call a session from anywhere in the mailbox:
undefined local variable or `session 'method for ApplicationMailer: Class
A less desirable way to handle this is to pass the session variable into my mail program calls. I would rather not do this as it does not seem very dry and will require changes in most of my code.
Jared source share