Sha256: 5c03dca603a1d15e6c6009845822df04a1262efc4148a2f605860505b42708ba

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 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

    default_scope -> { order(:ord => :asc) }

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
c80_push-0.1.0.2 app/models/c80_push/dealer.rb
c80_push-0.1.0.1 app/models/c80_push/dealer.rb