Permalink
Browse files

added limit method

  • Loading branch information...
1 parent d0cb558 commit 1066ff7341fd2793192adc959388a4563d63f7d3 @leemartin committed Nov 7, 2011
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/acts_as_voteable.rb
View
@@ -53,6 +53,7 @@ def plusminus_tally(*args)
t = t.where("joined_#{Vote.table_name}.voteable_type = '#{self.name}'")
t = t.group("joined_#{Vote.table_name}.voteable_id, joined_#{Vote.table_name}.vote_total, #{column_names_for_tally}")
+ t = t.limit(options[:limit]) if options[:limit]
t = t.where("joined_#{Vote.table_name}.created_at >= ?", options[:start_at]) if options[:start_at]
t = t.where("joined_#{Vote.table_name}.created_at <= ?", options[:end_at]) if options[:end_at]
t = options[:ascending] ? t.order("joined_#{Vote.table_name}.vote_total") : t.order("joined_#{Vote.table_name}.vote_total DESC")

0 comments on commit 1066ff7

Please sign in to comment.