Class: Spree::Store
- Inherits:
-
Base
- Object
- ActiveRecord::Base
- Base
- Spree::Store
show all
- Defined in:
- app/models/spree/store.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
display_includes, #initialize_preference_defaults, page, preference
#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Class Method Details
.current(store_key = nil) ⇒ Object
17
18
19
20
21
|
# File 'app/models/spree/store.rb', line 17
def self.current(store_key = nil)
Spree::Deprecation.warn "Spree::Store.current needs a code or URL as an argument. If you want the default store use Spree::Store.default", caller if !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
23
24
25
|
# File 'app/models/spree/store.rb', line 23
def self.default
where(default: true).first || new
end
|
Instance Method Details
#default_cart_tax_location ⇒ Object
27
28
29
30
|
# File 'app/models/spree/store.rb', line 27
def default_cart_tax_location
@default_cart_tax_location ||=
Spree::Tax::TaxLocation.new(country: Spree::Country.find_by(iso: cart_tax_country_iso))
end
|