Sha256: 349ec8725b59ff2d50db3616c4014ec1ba5c4351fe0d5b9326b8c67c537a2186
Contents?: true
Size: 818 Bytes
Versions: 25
Compression:
Stored size: 818 Bytes
Contents
module Spree class Country < Spree::Base has_many :states, -> { order(:name) }, dependent: :destroy has_many :addresses, dependent: :nullify has_many :prices, class_name: "Spree::Price", foreign_key: "country_iso", primary_key: "iso" validates :name, :iso_name, presence: true 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 def <=>(other) name <=> other.name end def to_s name end end end
Version data entries
25 entries across 25 versions & 1 rubygems