Class: Spree::Country
- Inherits:
-
Base
- Object
- ActiveRecord::Base
- Base
- Spree::Country
show all
- Defined in:
- app/models/spree/country.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
display_includes, page, preference, #preferences
#generate_permalink, #save_permalink
Class Method Details
.available(restrict_to_zone: Spree::Config[:checkout_zone]) ⇒ Object
22
23
24
25
26
27
28
|
# File 'app/models/spree/country.rb', line 22
def self.available(restrict_to_zone: Spree::Config[:checkout_zone])
checkout_zone = Zone.find_by(name: restrict_to_zone)
return checkout_zone.country_list if checkout_zone.try(:kind) == 'country'
all
end
|
.default ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'app/models/spree/country.rb', line 13
def self.default
if Spree::Config.default_country_id
Spree::Deprecation.warn("Setting your default country via its ID is deprecated. Please set your default country via the `default_country_iso` setting.", caller)
find_by(id: Spree::Config.default_country_id) || find_by!(iso: Spree::Config.default_country_iso)
else
find_by!(iso: Spree::Config.default_country_iso)
end
end
|
Instance Method Details
#<=>(other) ⇒ Object
30
31
32
|
# File 'app/models/spree/country.rb', line 30
def <=>(other)
name <=> other.name
end
|
#to_s ⇒ Object
34
35
36
|
# File 'app/models/spree/country.rb', line 34
def to_s
name
end
|