Class: Spree::Country

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

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

.defaultObject



9
10
11
12
13
14
15
16
# File 'app/models/spree/country.rb', line 9

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



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

def <=>(other)
  name <=> other.name
end

#to_sObject



22
23
24
# File 'app/models/spree/country.rb', line 22

def to_s
  name
end