Sha256: dda01b9f3b71a51e22023917567bc78f32ea5cd300a9a56a783cbd7d5a38a90c
Contents?: true
Size: 926 Bytes
Versions: 6
Compression:
Stored size: 926 Bytes
Contents
module Tienda # The Tienda::Country model stores countries which can be used for delivery & billing # addresses for orders. # # You can use the Tienda::CountryImporter to import a pre-defined list of countries # into your database. This automatically happens when you run the 'tienda:setup' # rake task. class Country < ActiveRecord::Base # All orders which have this country set as their billing country has_many :billed_orders, dependent: :restrict_with_exception, class_name: 'Tienda::Order', foreign_key: 'billing_country_id' # All orders which have this country set as their delivery country has_many :delivered_orders, dependent: :restrict_with_exception, class_name: 'Tienda::Order', foreign_key: 'delivery_country_id' # All countries ordered by their name asending scope :ordered, -> { order(:name => :asc) } # Validations validates :name, presence: true end end
Version data entries
6 entries across 6 versions & 1 rubygems