Sha256: 4f4c0865e497348956743461bba55cf01f8ddbd6e818ae5b493cb388a323c96c
Contents?: true
Size: 575 Bytes
Versions: 13
Compression:
Stored size: 575 Bytes
Contents
class Province < ActiveRecord::Base # Scopes, Attrs, Etc. default_scope order("title ASC") # Relationships belongs_to :country has_one :tax_rate has_many :addresses # Validations validates_presence_of :title, :code validates_uniqueness_of :title, :code def self.options_for_select(options={}) options[:add_blank] ||= false text_for_blank = options[:text_for_blank] || "All" provinces = Province.all.collect { |p| [p.title, p.id] } if options[:add_blank] provinces.unshift [text_for_blank, 0] end provinces end end
Version data entries
13 entries across 13 versions & 1 rubygems