Sha256: eb617e0a3e2531651e9f55e25c5039e51b4e54a82a9bbae00d4d9c0b0dbed5cf
Contents?: true
Size: 640 Bytes
Versions: 11
Compression:
Stored size: 640 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 # open up everything for mass assignment attr_protected 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
11 entries across 11 versions & 1 rubygems