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.
24 lines
558 B
24 lines
558 B
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
|
|
[address, conference.city.city, conference.city.territory, conference.city.country].join(', ')
|
|
end
|
|
|
|
def self.all_spaces
|
|
Workshop.all_spaces + [:event_space]
|
|
end
|
|
|
|
def self.all_amenities
|
|
Workshop.all_needs
|
|
end
|
|
end
|
|
|