diff options
author | Andrew8xx8 <avk@8xx8.ru> | 2013-02-18 12:36:50 +0400 |
---|---|---|
committer | Andrew8xx8 <avk@8xx8.ru> | 2013-02-18 14:43:49 +0400 |
commit | f97296597caf34bb66a3e28a7419665757608795 (patch) | |
tree | ad026fed21d256f6731068300065ad8114338339 /app | |
parent | 8db3920c01dfa4cf6c83afd67418bab8cb785bac (diff) |
Issuable consern uses StateMachine now
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/issuable.rb | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 645b35ec660..85337583640 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -17,10 +17,9 @@ module Issuable validates :project, presence: true validates :author, presence: true validates :title, presence: true, length: { within: 0..255 } - validates :closed, inclusion: { in: [true, false] } - scope :opened, -> { where(closed: false) } - scope :closed, -> { where(closed: true) } + scope :opened, -> { with_state(:opened) } + scope :closed, -> { with_state(:closed) } scope :of_group, ->(group) { where(project_id: group.project_ids) } scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } scope :assigned, ->(u) { where(assignee_id: u.id)} @@ -62,14 +61,6 @@ module Issuable assignee_id_changed? end - def is_being_closed? - closed_changed? && closed - end - - def is_being_reopened? - closed_changed? && !closed - end - # # Votes # |