How do I combine two methods into one json formatted variable?
- by JZ
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