Class: Allinone::SiteSelector
- Inherits:
-
Object
- Object
- Allinone::SiteSelector
- Defined in:
- lib/allinone/site_selector.rb
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(request_host) ⇒ SiteSelector
constructor
A new instance of SiteSelector.
Constructor Details
#initialize(request_host) ⇒ SiteSelector
Returns a new instance of SiteSelector.
4 5 6 7 8 |
# File 'lib/allinone/site_selector.rb', line 4 def initialize(request_host) @request_host = request_host.downcase @@domains_map_last_build_at ||= Time.at(0).to_datetime.utc setup_domains_map end |
Instance Method Details
#fetch ⇒ Object
10 11 12 13 |
# File 'lib/allinone/site_selector.rb', line 10 def fetch site_id = @@domains_map[@request_host] Site.where(id: site_id).first end |