Permalink
Browse files

revert changes maded

  • Loading branch information...
1 parent bc21143 commit 9f4ba1428573f40bd98f3a179f5a465a7754f469 @rustyb committed Apr 1, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/acts_as_voteable.rb
View
@@ -25,11 +25,11 @@ module SingletonMethods
def plusminus_tally(params = {})
t = self.joins("LEFT OUTER JOIN #{Vote.table_name} ON #{self.table_name}.id = #{Vote.table_name}.voteable_id")
t = t.order("plusminus_tally DESC")
- #t = t.group("#{self.table_name}.id")
- t = t.group("#{self.column_names_for_tally}")
+ t = t.group("#{self.table_name}.id")
+ #t = t.group("#{self.column_names_for_tally}")
t = t.select("#{self.table_name}.*")
- #t = t.select("SUM(CASE CAST(#{Vote.table_name}.vote AS UNSIGNED) WHEN 1 THEN 1 WHEN 0 THEN -1 ELSE 0 END) AS plusminus_tally")
- t = t.select("SUM(CASE CAST(#{Vote.table_name}.vote AS #{ActiveRecord::Base.connection.type_to_sql(:integer)}) WHEN 1 THEN 1 WHEN 0 THEN -1 ELSE 0 END) AS plusminus")
+ t = t.select("SUM(CASE CAST(#{Vote.table_name}.vote AS UNSIGNED) WHEN 1 THEN 1 WHEN 0 THEN -1 ELSE 0 END) AS plusminus_tally")
+ #t = t.select("SUM(CASE CAST(#{Vote.table_name}.vote AS #{ActiveRecord::Base.connection.type_to_sql(:integer)}) WHEN 1 THEN 1 WHEN 0 THEN -1 ELSE 0 END) AS plusminus")
if params[:separate_updown]
t = t.select("SUM(CASE CAST(#{Vote.table_name}.vote AS UNSIGNED) WHEN 1 THEN 1 WHEN 0 THEN 0 ELSE 0 END) AS up")
t = t.select("SUM(CASE CAST(#{Vote.table_name}.vote AS UNSIGNED) WHEN 1 THEN 0 WHEN 0 THEN 1 ELSE 0 END) AS down")

0 comments on commit 9f4ba14

Please sign in to comment.