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

page

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



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

def self.default
  find(Spree::Config[:default_country_id])
rescue ActiveRecord::RecordNotFound
  first
end

.states_required_by_country_idObject



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

def self.states_required_by_country_id
  ActiveSupport::Deprecation.warn "Spree::Country.states_required_by_country_id is deprecated and will be removed from future releases, Implement it yourself.", caller
  states_required = Hash.new(true)
  all.each { |country| states_required[country.id.to_s]= country.states_required }
  states_required
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#to_sObject



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

def to_s
  name
end