so i have this piece of code:
render :json => { :objects => @object.object_children }
This works. But What I only want are certain attributes only. I saw this: filter json render in rails 3 and in it is this:
respond_to do |format|
format.json { render json: @objects.object_children, :only => [:id, :name] }
end
It works, but it returns data without a label, just like this:
id":null,"name":"foo"
I want the ":objects =>" label in it. Thanks