diff options
author | Rhenium <rhenium@rhe.jp> | 2014-02-22 11:45:13 +0900 |
---|---|---|
committer | Rhenium <rhenium@rhe.jp> | 2014-02-22 11:45:13 +0900 |
commit | c48ee883b13a54a8ad5b868474ca3ad9a8f3462d (patch) | |
tree | 7cb6ca371e85222acf2b54d37e0e066e5c6cf984 /app/models | |
parent | ea09755a7b11d886715f5ca5ed8bbfb53ed973e7 (diff) | |
download | aclog-c48ee883b13a54a8ad5b868474ca3ad9a8f3462d.tar.gz |
fix Tweet.reacted: allow 0 for reactions_count threshold
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/tweet.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/tweet.rb b/app/models/tweet.rb index b3da0dd..30d1370 100644 --- a/app/models/tweet.rb +++ b/app/models/tweet.rb @@ -12,7 +12,7 @@ class Tweet < ActiveRecord::Base has_many :retweeters, -> { order("retweets.id") }, through: :retweets, source: :user scope :recent, ->(days = 3) { where("tweets.id > ?", snowflake_min(Time.zone.now - days.days)) } - scope :reacted, ->(count = nil) { where("reactions_count >= ?", [count.to_i, 1].max) } + scope :reacted, ->(count = nil) { where("reactions_count >= ?", (count || 1).to_i) } scope :not_protected, -> { includes(:user).where(users: {protected: false}) } scope :max_id, -> id { where("tweets.id <= ?", id.to_i) if id } |