Class: Spree::Store
- Defined in:
- app/models/spree/store.rb
Overview
Records store specific configuration such as store name and URL.
Spree::Store provides the foundational ActiveRecord model for recording information specific to your store such as its name, URL, and tax location. This model will provide the foundation upon which [support for multiple stores](github.com/solidusio/solidus/issues/112) hosted by a single Solidus implementation can be built.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
display_includes, #initialize_preference_defaults, page, preference
Methods included from Preferences::Preferable
#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Class Method Details
.current(store_key) ⇒ Object
24 25 26 27 |
# File 'app/models/spree/store.rb', line 24 def self.current(store_key) current_store = Store.find_by(code: store_key) || Store.by_url(store_key).first if store_key current_store || Store.default end |
.default ⇒ Object
29 30 31 |
# File 'app/models/spree/store.rb', line 29 def self.default where(default: true).first || new end |
Instance Method Details
#default_cart_tax_location ⇒ Object
33 34 35 36 |
# File 'app/models/spree/store.rb', line 33 def default_cart_tax_location @default_cart_tax_location ||= Spree::Tax::TaxLocation.new(country: Spree::Country.find_by(iso: cart_tax_country_iso)) end |