diff options
author | Robb Kidd <robb@thekidds.org> | 2012-05-20 22:15:13 +0400 |
---|---|---|
committer | Robb Kidd <robb@thekidds.org> | 2012-06-20 22:09:46 +0400 |
commit | 2416e3cb19d6a668fc3274b1ae3382f4119dac1d (patch) | |
tree | f980fe7df789eb2e1f7c7e1cf5dd999ea6256a20 /app | |
parent | f6035552e5d83b36f69e1ac7fa4b40ee5f7ab4fb (diff) |
Add new utility method for an issue to know whether it is being reassigned
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 3ed47ef1bea..f1cb2e220b9 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -27,7 +27,7 @@ class Issue < ActiveRecord::Base validates :title, :presence => true, :length => { :within => 0..255 } - + validates :description, :length => { :within => 0..2000 } @@ -55,6 +55,15 @@ class Issue < ActiveRecord::Base def new? today? && created_at == updated_at end + + # Return the number of +1 comments (upvotes) + def upvotes + notes.select(&:upvote?).size + end + + def is_being_reassigned? + assignee_id_changed? + end end # == Schema Information # |