I'm adding jbuilder to a Rails app -- great tool!
I'm getting the list of records I want, but it has extra output I don't want.
This is the jbuilder code:
json.locations @locations do |location|
json.id location.id
json.name location.name
end
The output is:
{
- locations: [
{
id: 1,
name: "Name 1"
},
{
id: 2,
name: "Name 2"
},
What I need is:
[
{
id: 1,
name: "Name 1"
},
{
id: 2,
name: "Name 2"
},
How can I remove the { - locations:
???
Thanks!!
UPDATE:
I'm hoping there is a line of code for jbuilder that would exclude the root.