Commit b62dbe79e39d4d7d5964523ee194478bf33371eb

Authored by Pius Uzamere
1 parent c6569df2

send the question name along with the choice to save a server roundtrip in some cases

app/controllers/choices_controller.rb
... ... @@ -28,7 +28,7 @@ class ChoicesController < InheritedResources::Base
28 28 @choice.reload
29 29 @choice.compute_score!
30 30 @choice.reload
31   - render :xml => @choice.to_xml(:methods => [:item_data, :wins_plus_losses])}
  31 + render :xml => @choice.to_xml(:methods => [:item_data, :wins_plus_losses, :question_name])}
32 32 format.json { render :json => @choice.to_json(:methods => [:data])}
33 33 end
34 34 end
... ...
app/models/choice.rb
... ... @@ -15,6 +15,10 @@ class Choice < ActiveRecord::Base
15 15  
16 16 attr_accessor :data
17 17  
  18 + def question_name
  19 + question.name
  20 + end
  21 +
18 22 def item_data
19 23 item.data
20 24 end
... ...