I am adding jbuilder to a Rails application - a great tool!
I get a list of entries that I want, but it has additional output that I don't want.
This is the jbuilder code:
json.locations @locations do |location|
json.id location.id
json.name location.name
end
Conclusion:
{
- locations: [
{
id: 1,
name: "Name 1"
},
{
id: 2,
name: "Name 2"
},
What I need:
[
{
id: 1,
name: "Name 1"
},
{
id: 2,
name: "Name 2"
},
How to remove {- locations:
???
Thank!!
UPDATE:
I hope there is a line of code for jbuilder that will eliminate the root.
source
share