Closed HungYuHei closed 12 years ago
a moment ago, I changed something(but I forgot the details), then I got "undefined method `gmaps4rails_options'"
please notice that the piror error I mentioned is "undefined method `to_gmaps4rails'" which is different
I have made a pull request for this If you are just developing you can use my repo branch is "MoveIn.."
just released 1.4.3 let me know if you still have this problem
Due to this issue, right now I manually call the google-map API instead of using the gem
However, I would like to do some test later :)
I have a same issue over here. My environment is :
@zolzaya : ok I think I understand.
In Mongoid: User.all
is a Mongoid::Criteria
. I should add to_gmaps4rails
to this class.
In the meantime, you can simply do: User.all.to_a.to_gmaps4rails
Thank you for reply. It's working fine. :)
Apnea, I have encountered this problem many a time: undefined method gmaps4rails_options. The only way I can bypass it is by doing .to_json instead. However, that is in the case of polylines, polygons, etc etc. But when it comes to markers, even if I do .to_json, I just get a grey map :(
This is incredibly frustrating. Any ideas?
Rails 3.2.3 ruby 1.9.3p0
Edit: I just did bundle update and now it's gmaps4rails 1.4.8 (still same error). Certain version I should try? I'll try 1.4.3.
@DavidPardy : what orm do you use?
I'm new to web dev but I'm fairly certain the ORM would be Active Record?
Also here's a github to what I'm trying to accomplish. Fairly simple: create a location in /locations, create a map in /maps using the location_id, and boom the location shows up on the map as a placemark.
https://github.com/DavidPardy/Placemarks-Using-Gmaps4Rails
Edit: The map controller and map view is a little messy, just because I'm toying with stuff. Also, I have tried 1.4.3, 1.4.7, and 1.4.8, not working for any.
Well you do Map.all.to_gmaps4rails
but Map doesn't contain acts_as_gmappable
Right, good call, not sure how I missed that. n00b like I said.
I amaze myself sometimes. I just started a new app with just a map model and that's much easier.
Thanks alot for your help sir, greatly appreciate it.
@DavidPardy No problem, we all face this kind of situation. Have fun coding :)
Don't hate me if I come back with more questions later, lol :)
@DavidPardy Issue tracker is made for issues, please ask questions on stackoverflow.
I am using gmaps4rails gem to show map on view part. gmaps4rails '1.5.6' rails 4.0.0 ruby 2.0.0
Model Action class Location < ActiveRecord::Base acts_as_gmappable
def gmaps4rails_address location end end
Controller Action class LocationsController < ApplicationController def show binding.pry @locations = Location.all.to_gmaps4rails end end
Here its showing **NoMethodError: undefined method `to_gmap4rails' # Any response please reply
1.5.6 is not compatible with rails 4
But i have created one dummy app with rails 4 its working fine.
to_gmap4rails
should be to_gmaps4rails
...............
yes i did silly mistake sorry for disturbing.
Thanks alot
its working fine.
By the way, stop spamming the issues, post questions on stackoverflow
ok thanks
I've done everything that the README said
but I still got "undefined method `to_gmaps4rails' for #User:0x007f9ea726af78" error
btw, my environment is : rails3.1, mongoid2.3.3, gmaps4rails1.4.2
and here is my Model snippet:
my controller:
Did I miss something ?