Google maps for rails: How to normalize two address fields -


i using google maps rails gem - https://github.com/apneadiving/google-maps-for-rails. according there model customization guide here - https://github.com/apneadiving/google-maps-for-rails/wiki/model-customization normalize address field. aparently have 2 address (from , to). how do it?

i tried this

  acts_as_gmappable :normalized_address => "from_address" && "to_address"    def gmaps4rails_address     from_address && to_address   end 

it doesnt work entirely. to_address gets normalized. from_address stays entered user (although calculates fine. have normalized version).

any help?

i think problem models rather gmaps4rails. should have each address polymorphic object. attach twice parent model; once from_address , once to_address. each address can normalized on it's own.

edited example....

example:

class address < activerecord::base   belongs_to :mappable, :polymorphic => true   acts_as_gmappable :normalized_address => "address_string"    def gmaps4rails_address      address_string   end end  class yourmainmodel < activerecord::base   has_one :from_address, :as => :mappable   has_one :to_address, :as => :mappable end 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -