I have a survey application with he following models:
Surveys has_many Questions
Questions has_many Answers
When a user takes a survey, they call take_survey and it renders a
collection of partials _survey_questions. These questions are set to
display:none and revealed using an AJAX call to ‘reveal_next_question’
and page.show. It also calls an extra load for images as I am using
FlexImage. Are CACHE hits free or am I doing things wrong? I am having
trouble interpreting the output from the Mongrel terminal:
take_survey METHOD
def take_survey
@survey = Survey.find(params[:id], :include => [:questions =>
:answers])
end
SURVEY LOAD
Processing SurveysController#take_survey (for xxx at 2009-01-23
20:43:40) [GET]
Parameters: {“action”=>“take_survey”}
Survey Load (0.4ms) SELECT * FROM “surveys” WHERE (“surveys”.“id” =
1)
Question Load (2.3ms) SELECT “questions”.* FROM “questions” WHERE
(“questions”.survey_id = 1) ORDER BY questions.position ASC
Answer Load (3.7ms) SELECT “answers”.* FROM “answers” WHERE
(“answers”.question_id IN (1,2,3,4,5)) ORDER BY position ASC
Rendering template within layouts/survey
Rendering surveys/take_survey
Question Load (0.7ms) SELECT * FROM “questions” WHERE
(“questions”.“id” = 1)
CACHE (0.0ms) SELECT * FROM “questions” WHERE (“questions”.“id” = 1)
CACHE (0.0ms) SELECT * FROM “questions” WHERE (“questions”.“id” = 1)
CACHE (0.0ms) SELECT * FROM “questions” WHERE (“questions”.“id” = 1)
CACHE (0.0ms) SELECT * FROM “questions” WHERE (“questions”.“id” = 1)
Rendered questions/_survey_question (8.1ms)
Rendered questions/_survey_question (2.1ms)
Rendered questions/_survey_question (2.4ms)
Question Load (0.6ms) SELECT * FROM “questions” WHERE
(“questions”.“id” = 4)
CACHE (0.0ms) SELECT * FROM “questions” WHERE (“questions”.“id” = 4)
CACHE (0.0ms) SELECT * FROM “questions” WHERE (“questions”.“id” = 4)
Rendered questions/_survey_question (4.2ms)
Rendered questions/_survey_question (1.3ms)
Completed in 150ms (View: 28, DB: 8) | 200 OK [http://xxx/take_survey/1]
Processing QuestionsController#show to png (for xxx at 2009-01-23
20:43:43) [GET]
Parameters: {“format”=>“png”, “action”=>“show”, “id”=>“1”,
“controller”=>“questions”}
Question Load (0.6ms) SELECT * FROM “questions” WHERE
(“questions”.“id” = 1)
Rendering questions/show
Completed in 149ms (View: 135, DB: 1) | 200 OK
[http://xxx/questions/1.png]
REVEAL NEXT QUESTION
Processing SurveysController#reveal_next_question (for xxx at 2009-01-23
20:50:27) [POST]
Parameters: {“action”=>“reveal_next_question”, “next_question”=>“2”}
Question Load (0.5ms) SELECT * FROM “questions” WHERE
(“questions”.“id” = 2)
Answer Load (1.3ms) SELECT “answers”.* FROM “answers” WHERE
(“answers”.question_id = 2) ORDER BY position ASC
Survey Load (0.8ms) SELECT * FROM “surveys” WHERE (“surveys”.“id” =
1)
Completed in 39ms (View: 13, DB: 3) | 200 OK
[http://xxx/surveys/reveal_next_question]