diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-09 20:37:04 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-09 20:37:04 +0300 |
commit | 0f2798d498c69372137d13a8ba3ec8e87b7f0a8a (patch) | |
tree | e2fa3ed8d25c5a54e4b8baf70e710008d1a03754 /app/models/issue.rb | |
parent | 52cd655f71c6a5393b71640c13cd95e35e8d2624 (diff) | |
parent | 85e039049cba5ac1bf92e6cbba2ea1236d6892f7 (diff) | |
download | gitlab-ce-0f2798d498c69372137d13a8ba3ec8e87b7f0a8a.tar.gz |
Merge branch 'feature/refactoring_scopes_pr' of https://github.com/Undev/gitlabhq into Undev-feature/refactoring_scopes_pr
Conflicts:
db/schema.rb
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index cb7ee9fda37..91dd6477b04 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -25,19 +25,9 @@ class Issue < ActiveRecord::Base acts_as_taggable_on :labels - class << self - def cared(user) - where('assignee_id = :user', user: user.id) - end - - def authored(user) - where('author_id = :user', user: user.id) - end - - def open_for(user) - opened.assigned(user) - end - end + scope :cared, ->(user) { where(assignee_id: user) } + scope :authored, ->(user) { where(author_id: user) } + scope :open_for, ->(user) { opened.assigned(user) } state_machine :state, initial: :opened do event :close do |