Render :json question

I am calling “render :json => @buildings” from a Buildings

It’s returning
[{“building”:{“value”:“114 3rd Ave New York”}},{“building”:
{“value”:“114 1st Pl Brooklyn”}},{“building”:{“value”:“1140 2nd Ave
New York”}},{“building”:{“value”:“1143 2nd Ave New York”}}]

As expected, however, I need the json array to NOT be nested within a
“building” node.

i.e. I need:
[{“value”:“114 3rd Ave New York”}, {“value”:“114 1st Pl Brooklyn”},
{“value”:“1140 2nd Ave New York”}, {“value”:“1143 2nd Ave New York”}]

I have tried passing various options to the render call and other
to_json and as_json variations.

How would I do this?

Thanks, Elliott G


ActiveRecord::Base.include_root_in_json = false



Thanks a ton Eduardo.

On Mar 7, 2:28pm, “Eduardo de O. Hernandes” [email protected]