Sha256: 402ddec4f090fd84b05f3c4608fdd0059b318d56b5a0c5b9d6773b36770d6497

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module C80Push
  class Dealer < ActiveRecord::Base
    has_and_belongs_to_many :regions
    has_many :offices, :dependent => :destroy
    accepts_nested_attributes_for :offices,
                                  :reject_if => lambda { |attributes|
                                    !attributes.present?
                                  },
                                  :allow_destroy => true

    validates :title,
              :uniqueness => true,
              :presence => true

    validates :ord,
              :presence => true

    scope :def_order, -> { order(:ord => :asc) }

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
c80_push-0.1.0 app/models/c80_push/dealer.rb