Sha256: 8e09f3d87bb08a77c166f6c0e53ef742fcde491375590d36c18c95148b2326f6

Contents?: true

Size: 635 Bytes

Versions: 8

Compression:

Stored size: 635 Bytes

Contents

module C80Push
  class Dealer < ActiveRecord::Base
    has_and_belongs_to_many :regions
    has_and_belongs_to_many :presets
    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

8 entries across 8 versions & 1 rubygems

Version Path
c80_push-0.1.0.11 app/models/c80_push/dealer.rb
c80_push-0.1.0.10 app/models/c80_push/dealer.rb
c80_push-0.1.0.8 app/models/c80_push/dealer.rb
c80_push-0.1.0.7 app/models/c80_push/dealer.rb
c80_push-0.1.0.6 app/models/c80_push/dealer.rb
c80_push-0.1.0.5 app/models/c80_push/dealer.rb
c80_push-0.1.0.4 app/models/c80_push/dealer.rb
c80_push-0.1.0.3 app/models/c80_push/dealer.rb