2016 design

This commit is contained in:
Godwin
2016-05-09 21:45:23 -07:00
parent 48ed91e24c
commit 5d25e09bc4
190 changed files with 4665 additions and 1289 deletions
+21 -21
View File
@@ -1,21 +1,21 @@
class Location < ActiveRecord::Base
#attr_accessible :title, :country, :territory, :city, :street, :postal_code, :latitude, :longitude
has_many :locations_organization
has_many :organizations, :through => :locations_organization
geocoded_by :full_address
reverse_geocoded_by :latitude, :longitude, :address => :full_address
after_validation :geocode, if: ->(obj){ obj.country_changed? or obj.territory_changed? or obj.city_changed? or obj.street_changed? or obj.postal_code_changed? }
def full_address
addr = title
addr = (addr ? ', ' : '') + (street || '')
addr = (addr ? ', ' : '') + (city || '')
addr = (addr ? ', ' : '') + (territory || '')
addr = (addr ? ' ' : '') + (country || '')
addr = (addr ? ' ' : '') + (postal_code || '')
addr
end
end
class Location < ActiveRecord::Base
#attr_accessible :title, :country, :territory, :city, :street, :postal_code, :latitude, :longitude
has_many :locations_organization
has_many :organizations, :through => :locations_organization
geocoded_by :full_address
reverse_geocoded_by :latitude, :longitude, :address => :full_address
after_validation :geocode, if: ->(obj){ obj.country_changed? or obj.territory_changed? or obj.city_changed? or obj.street_changed? or obj.postal_code_changed? or obj.latitude.blank? or obj.longitude.blank? }
def full_address
addr = title
addr = (addr ? ', ' : '') + (street || '')
addr = (addr ? ', ' : '') + (city || '')
addr = (addr ? ', ' : '') + (territory || '')
addr = (addr ? ' ' : '') + (country || '')
addr = (addr ? ' ' : '') + (postal_code || '')
addr
end
end