Reputation: 261
In the controller I would like to try something like this:
@json = User.all.to_gmaps4rails
@json << Admin.all.to_gmaps4rails
But thats not gonna work. Is there a standard implementation how to deal with it?
Upvotes: 0
Views: 271
Reputation: 671
(JSON.parse( User.all.to_gmaps4rails) + JSON.parse( Admin.all.to_gmaps4rails)).to_json
Upvotes: 0
Reputation: 115521
You could do:
json_hash = JSON.parse(User.all.to_gmaps4rails)
json_hash2 = JSON.parse(Admin.all.to_gmaps4rails)
@json = (json_hash + json_hash2).to_json
Not terrific, maybe I should patch the gem.
Upvotes: 1