I'm writing my own API controllers using Angular $resource. Is it better to render all objects on the RAILS side controller with 1 resource, or make 3 different resource calls.
app.factory("responseResource", function($resource) {
return $resource("/api/v1/responses/:id", {id: "@id" },
{
get: { method: "GET" },
update: { method: "PUT" }
});
});
class Api::V1::ResponsesController < Api::V1::ApiController
def show
@response = Response.find(params[:id])
@rubric = Rubric.find(@response.rubric_id)
@questions = @rubric.questions
render json: { response: @response, questions: @questions, rubric: @rubric }
end
end