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

Methods included from Spree::Core::Permalinks

#generate_permalink, #save_permalink

Class Method Details

.available(restrict_to_zone: Spree::Config[:checkout_zone]) ⇒ Object


17
18
19
20
21
22
23
# File 'app/models/spree/country.rb', line 17

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

.defaultObject


13
14
15
# File 'app/models/spree/country.rb', line 13

def self.default
  find_by!(iso: Spree::Config.default_country_iso)
end

Instance Method Details

#<=>(other) ⇒ Object


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

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

#to_sObject


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

def to_s
  name
end