summaryrefslogtreecommitdiff
path: root/app/models/milestone.rb
diff options
context:
space:
mode:
authorJeroen Nijhof <jeroen@jeroennijhof.nl>2016-01-06 14:55:44 +0100
committerJeroen Nijhof <jeroen@jeroennijhof.nl>2016-01-06 14:55:44 +0100
commit9b28220f8874c7ab342286e74f0b21895a2dd777 (patch)
tree0b2ec2d97a95796893778623adabb975e0224b64 /app/models/milestone.rb
parentd4690af8bc283c402e49cb8b3056c7de9d57e886 (diff)
parent8b39b8cd54bb73b485ee6ea7fc5d3bbfbe07cd5d (diff)
downloadgitlab-ce-9b28220f8874c7ab342286e74f0b21895a2dd777.tar.gz
Merge gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r--app/models/milestone.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 2ff16e2825c..d8c7536cd31 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -16,12 +16,13 @@
class Milestone < ActiveRecord::Base
# Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned.
- MilestoneStruct = Struct.new(:title, :name)
- None = MilestoneStruct.new('No Milestone', 'No Milestone')
- Any = MilestoneStruct.new('Any', '')
+ MilestoneStruct = Struct.new(:title, :name, :id)
+ None = MilestoneStruct.new('No Milestone', 'No Milestone', 0)
+ Any = MilestoneStruct.new('Any Milestone', '', -1)
include InternalId
include Sortable
+ include StripAttribute
belongs_to :project
has_many :issues
@@ -35,6 +36,8 @@ class Milestone < ActiveRecord::Base
validates :title, presence: true
validates :project, presence: true
+ strip_attributes :title
+
state_machine :state, initial: :active do
event :close do
transition active: :closed