Commit 739bcd4cb163210716a2b8dad39df493d234802d
1 parent
1b00d7f2
Exists in
master
and in
1 other branch
added creator_identifier to choices index action result and fixed Vote default s…
…cope (error in boolean field in postgres database)
Showing
3 changed files
with
6 additions
and
2 deletions
Show diff stats
app/controllers/choices_controller.rb
... | ... | @@ -29,7 +29,7 @@ class ChoicesController < InheritedResources::Base |
29 | 29 | end |
30 | 30 | end |
31 | 31 | index! do |format| |
32 | - format.xml { render :xml => @choices.to_xml(:only => [ :data, :score, :id, :active, :created_at, :wins, :losses], :methods => :user_created)} | |
32 | + format.xml { render :xml => @choices.to_xml(:only => [ :data, :score, :id, :active, :created_at, :wins, :losses], :methods => [:user_created, :creator_identifier])} | |
33 | 33 | end |
34 | 34 | |
35 | 35 | end | ... | ... |
app/models/choice.rb
... | ... | @@ -81,6 +81,10 @@ class Choice < ActiveRecord::Base |
81 | 81 | self.creator_id != self.question.creator_id |
82 | 82 | end |
83 | 83 | |
84 | + def creator_identifier | |
85 | + self.creator.identifier | |
86 | + end | |
87 | + | |
84 | 88 | def compute_bt_score(btprobs = nil) |
85 | 89 | if btprobs.nil? |
86 | 90 | btprobs = self.question.bradley_terry_probs | ... | ... |
app/models/vote.rb
... | ... | @@ -19,7 +19,7 @@ class Vote < ActiveRecord::Base |
19 | 19 | named_scope :active, :include => :choice, :conditions => { 'choices.active' => true } |
20 | 20 | named_scope :active_loser, :include => :loser_choice, :conditions => { 'choices.active' => true } |
21 | 21 | |
22 | - default_scope :conditions => "#{table_name}.valid_record = 1" | |
22 | + default_scope :conditions => {"#{table_name}.valid_record" => true } | |
23 | 23 | |
24 | 24 | serialize :tracking |
25 | 25 | ... | ... |