You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
require 'geocoder'
|
|
|
|
require 'geocoder/railtie'
|
|
|
|
|
|
|
|
Geocoder::Railtie.insert
|
|
|
|
|
|
|
|
class EventLocation < ActiveRecord::Base
|
|
|
|
belongs_to :conference
|
|
|
|
geocoded_by :full_address
|
|
|
|
|
|
|
|
reverse_geocoded_by :latitude, :longitude, :address => :full_address
|
|
|
|
after_validation :geocode, if: ->(obj){ obj.address_changed? }
|
|
|
|
|
|
|
|
def full_address
|
|
|
|
l = conference.location
|
|
|
|
[address, l.city, l.territory, l.country].join(', ')
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.all_spaces
|
|
|
|
Workshop.all_spaces + [:event_space]
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.all_amenities
|
|
|
|
Workshop.all_needs
|
|
|
|
end
|
|
|
|
end
|