Commit e9e218d68ce2231abb68ef49c9b5e18aecd0c25c
1 parent
2f7e222c
Exists in
master
and in
1 other branch
performance enhancement
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
app/controllers/questions_controller.rb
@@ -4,10 +4,15 @@ class QuestionsController < InheritedResources::Base | @@ -4,10 +4,15 @@ class QuestionsController < InheritedResources::Base | ||
4 | #has_scope :voted_on_by | 4 | #has_scope :voted_on_by |
5 | 5 | ||
6 | def show | 6 | def show |
7 | + @question = Question.find(params[:id]) | ||
8 | + @p = @question.picked_prompt | ||
9 | + left_choice_text = Proc.new { |options| options[:builder].tag!('left_choice_text', @p.left_choice.item.data) } | ||
10 | + right_choice_text = Proc.new { |options| options[:builder].tag!('right_choice_text', @p.right_choice.item.data) } | ||
11 | + picked_prompt_id = Proc.new { |options| options[:builder].tag!('picked_prompt_id', @p.id) } | ||
7 | show! do |format| | 12 | show! do |format| |
8 | session['prompts_ids'] ||= [] | 13 | session['prompts_ids'] ||= [] |
9 | format.xml { | 14 | format.xml { |
10 | - render :xml => @question.to_xml(:methods => [:item_count, :left_choice_text, :right_choice_text, :picked_prompt_id]) | 15 | + render :xml => @question.to_xml(:methods => [:item_count], :procs => [left_choice_text, right_choice_text, picked_prompt_id]) |
11 | } | 16 | } |
12 | end | 17 | end |
13 | end | 18 | end |