Class: Spree::Country

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.by_iso(iso) ⇒ Object



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

def self.by_iso(iso)
  where(['LOWER(iso) = ?', iso.downcase]).or(where(['LOWER(iso3) = ?', iso.downcase])).take
end

Instance Method Details

#<=>(other) ⇒ Object



26
27
28
# File 'app/models/spree/country.rb', line 26

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

#default?(store = nil) ⇒ Boolean

Returns:

  • (Boolean)


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

def default?(store = nil)
  store ||= Spree::Store.default
  self == store.default_country
end

#to_sObject



30
31
32
# File 'app/models/spree/country.rb', line 30

def to_s
  name
end