I'm building an array using jbuilder.
This is the tree.json.jbuilder code:
json.array!(@locations) do |location|
if location.is_root?
json.label location.name
json.id location.id
...
end
end
The json produced contains some "undefined" entries at the beginning:
[
{ },
{ },
{ },
{ },
{
label: "First Label",
id: 1,
...
Is there some way to stop the undefined (blank) entries?
Thanks!!