Hi,
I run a Ruby on Rails website that have multiple domain names. I have a "Website" table in the database that stores the configuration values related to each domain name:
Website
- domain
- name
- tagline
- admin_email
- etc...
At the moment, I load the website object at the start of each request (before_filter) in my ApplicationController:
@website = Website.find_by_domain(request.host)
The problem is when I need to access the @website object from my model's methods. I would like to avoid to have to pass @website everywhere. The best solution would be to have something similar to APP_CONFIG but per domain name.
def sample_model_property
- - "#{@website.name} is a great website!"
end
How would you do it?