This is a relatively simple one and I'm pretty sure its just syntax.
Im trying to render multiple objects as json as a response in a controller. So something like this:
def info
@allWebsites = Website.all
@allPages = Page.all
@allElementTypes = ElementType.all
@allElementData = ElementData.all
respond_to do |format|
format.json{render :json => @allWebsites}
format.json{render :json =>@allPages}
format.json{render :json =>@allElementTypes}
format.json{render :json =>@allElementData}
end
end
end
Problem is I'm only getting a single json back and its always the top one. Is there any way to render multiple objects this way?
Or should I create a new object made up of other objects.to_json?