diff --git a/app/controllers/choices_controller.rb b/app/controllers/choices_controller.rb index 8a9b9eb..ad98b79 100644 --- a/app/controllers/choices_controller.rb +++ b/app/controllers/choices_controller.rb @@ -29,7 +29,7 @@ class ChoicesController < InheritedResources::Base end end index! do |format| - format.xml { render :xml => @choices.to_xml(:only => [ :data, :score, :id, :active, :created_at, :wins, :losses], :methods => :user_created)} + format.xml { render :xml => @choices.to_xml(:only => [ :data, :score, :id, :active, :created_at, :wins, :losses], :methods => [:user_created, :creator_identifier])} end end diff --git a/app/models/choice.rb b/app/models/choice.rb index d34a50f..46852f1 100644 --- a/app/models/choice.rb +++ b/app/models/choice.rb @@ -81,6 +81,10 @@ class Choice < ActiveRecord::Base self.creator_id != self.question.creator_id end + def creator_identifier + self.creator.identifier + end + def compute_bt_score(btprobs = nil) if btprobs.nil? btprobs = self.question.bradley_terry_probs diff --git a/app/models/vote.rb b/app/models/vote.rb index 67e563e..08809ef 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -19,7 +19,7 @@ class Vote < ActiveRecord::Base named_scope :active, :include => :choice, :conditions => { 'choices.active' => true } named_scope :active_loser, :include => :loser_choice, :conditions => { 'choices.active' => true } - default_scope :conditions => "#{table_name}.valid_record = 1" + default_scope :conditions => {"#{table_name}.valid_record" => true } serialize :tracking -- libgit2 0.21.2