Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.