Class: Spree::Store

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/store.rb

Class Method Summary collapse

Methods inherited from Base

belongs_to_required_by_default, page, spree_base_scopes

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Class Method Details

.current(domain = nil) ⇒ Object


17
18
19
20
# File 'app/models/spree/store.rb', line 17

def self.current(domain = nil)
  current_store = domain ? Store.by_url(domain).first : nil
  current_store || Store.default
end

.defaultObject


22
23
24
25
26
# File 'app/models/spree/store.rb', line 22

def self.default
  Rails.cache.fetch('default_store') do
    where(default: true).first_or_initialize
  end
end