How do I combine two methods into one json formatted variable?

Posted by JZ on Stack Overflow See other posts from Stack Overflow or by JZ
Published on 2010-04-08T03:41:42Z Indexed on 2010/04/08 3:43 UTC
Read the original article Hit count: 374

Filed under:
|
|

I'm storing JSON formatted data into a var adds with the following methods:

var adds = <%= raw @add.to_a.to_json %>;

var adds = <%= raw @add.nearbys(1).to_json %>;

The first line of code stores the location of an individual in JSON format, the second line of code searches for that person's neighbors, within a 1 mile range. How do I combine both of these lines of code and store the data in JSON format in the var adds variable?

If you are interested in source, its here. The location is layout/adds.html.erb

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rails3