Class: DeliveryAddress

Inherits:
ApplicationRecord show all
Defined in:
app/models/delivery_address.rb

Overview

typed: ignore

Schema Information

Table name: delivery_addresses

id                  :integer          not null, primary key
contact_name        :string(191)
contact_number      :string(191)
detail              :text(16777215)
is_saved            :boolean          default(FALSE)
lat                 :decimal(10, 6)
lon                 :decimal(10, 6)
name                :text(16777215)
note_for_driver     :text(16777215)
primary             :boolean
created_at          :datetime         not null
updated_at          :datetime         not null
delivery_channel_id :bigint
user_id             :integer

Indexes

index_delivery_addresses_on_delivery_channel_id  (delivery_channel_id)
index_delivery_addresses_on_user_id              (user_id)

Foreign Keys

fk_rails_...  (delivery_channel_id => delivery_channels.id)
fk_rails_...  (user_id => users.id)

Instance Method Summary collapse

Methods inherited from ApplicationRecord

sync_carrierwave_url

Instance Method Details

#validate_lat_lonObject



48
49
50
51
52
53
# File 'app/models/delivery_address.rb', line 48

def validate_lat_lon
  if lat == 0.0 || lon == 0.0
    errors.add(:base, "Latitude and Longitude can not empty")
    throw :abort
  end
end