apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

undefined method `geocode?' #219

Closed Jeewes closed 12 years ago

Jeewes commented 12 years ago

I have "acts_as_gmappable" (gmaps4rails) and "acts_as_mappable" (Geokit) in my model definition. I have also defined gmaps4rails_address method.

Now I get undefined method 'geocode?'

DRY example in wiki suggests to define such method as follows:

def geocode? !(address.blank? || (!lat.blank? && !lng.blank?)) end

After that is says "undefined local variable or method 'address'".

Do I need address column in db or is lat and lng enough?

How can I fix this problem and why is geocode? method needed?

apneadiving commented 12 years ago

Doc states: The columns in his db are, lat, lng, address, gmaps.

Jeewes commented 12 years ago

True, my bad. That solves the problem, but I still wonder that I can't find anywhere the reason I need the geocode? method. It appears only in that one DRY example which is not explained so verbosely.

I'd really appreciate any insight of the purpose of geocode? method. Is it compolsory to have?

apneadiving commented 12 years ago

process_geocoding could be a boolean or a Proc/method returning a boolean.

The purpose is to know whether or not geocoding should be triggered.

All details are here: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Model-Customization

Jeewes commented 12 years ago

Thank you for your kind help.

Still a bit new to these things and I really appreciate the help.