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
- #available_locales ⇒ Object
- #available_locales=(locales) ⇒ Object
- #default_cart_tax_location ⇒ Object
Methods inherited from Base
display_includes, page, preference, #preferences
Methods included from Core::Permalinks
#generate_permalink, #save_permalink
Class Method Details
.current(store_key) ⇒ Object
52 53 54 55 56 |
# File 'app/models/spree/store.rb', line 52 def self.current(store_key) Spree::Deprecation.warn "Spree::Store.current is DEPRECATED" current_store = Store.find_by(code: store_key) || Store.by_url(store_key).first if store_key current_store || Store.default end |
.default ⇒ Object
58 59 60 |
# File 'app/models/spree/store.rb', line 58 def self.default where(default: true).first || new end |
Instance Method Details
#available_locales ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/models/spree/store.rb', line 34 def available_locales locales = super() if locales super().split(",").map(&:to_sym) else Spree.i18n_available_locales end end |
#available_locales=(locales) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/models/spree/store.rb', line 43 def available_locales=(locales) locales = locales.reject(&:blank?) if locales.empty? super(nil) else super(locales.map(&:to_s).join(",")) end end |