Sha256: fcb87bdb44084db20471647aa81806e443b2828ed19827961b35628a7645436a

Contents?: true

Size: 568 Bytes

Versions: 8

Compression:

Stored size: 568 Bytes

Contents

module C80Push
  class Office < ActiveRecord::Base
    has_and_belongs_to_many :regions
    belongs_to :dealer

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

    validates :ord,
              :presence => true

    validates :title,
              :presence => true

    validates :addr,
              :presence => true

    validates :gps,
              :presence => true,
              :format => { with: /\A\d+\.\d+,\s*\d+\.\d+\z/ }

    validates :tel,
              :presence => true

    def gps_arr
      self.gps.split(',').map! { |c| c.to_f }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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