New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
to_gmaps4rails(&blk) doesn't work with Mongoid #223
Comments
Actually, I've added It should be added it to the Criteria class I guess. Could you try this? Sent from my iPhone On 25 juin 2012, at 14:22, Nithin Bekalreply@reply.github.com wrote:
|
Sure, I'll try adding this tomorrow and send in a pull request. |
@apneadiving I got it to work by adding the method to I ran the tests after moving |
this is a very good idea! On Jun 26, 2012, at 9:19 AM, Nithin Bekal wrote:
|
Ok, I'll make the changes and send in a pull request later today. |
Fix issue #223: to_gmaps4rails(&blk) doesn't work with Mongoid
I'm not exactly sure if this is a bug or not, but it did confuse me for a while. I'm using the gmaps4rails gem version 1.5.2 with Mongoid. In my controller, I've been doing this:
The JSON generated by this doesn't contain the id field. It turns out you need to use
@places.to_a.to_gmaps4rails....
for the id to appear in JSON. This is the code that worked for me:I haven't tried this with ActiveRecord, so I'm not sure if this is the expected behavior there, but most of the examples I see don't seem to have
to_a
called on it. Could you confirm if this is the expected behavior?The text was updated successfully, but these errors were encountered: