Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
2f972ad4
Commit
2f972ad4
authored
Dec 05, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve stage values and use StaticModel
parent
d865aeda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
app/models/ci/stage.rb
app/models/ci/stage.rb
+11
-5
No files found.
app/models/ci/stage.rb
View file @
2f972ad4
module
Ci
module
Ci
class
Stage
<
ActiveRecord
::
Base
# Currently this is artificial object, constructed dynamically
include
ActiveModel
::
Model
# We should migrate this object to actual database record in the future
class
Stage
include
StaticModel
attr_reader
:pipeline
,
:name
attr_reader
:pipeline
,
:name
def
initialize
(
pipeline
,
name:
name
,
status:
status
=
nil
)
def
initialize
(
pipeline
,
name:
name
,
status:
nil
)
@pipeline
,
@name
,
@status
=
pipeline
,
name
,
status
@pipeline
,
@name
,
@status
=
pipeline
,
name
,
status
end
end
def
to_param
name
end
def
status
def
status
@status
||=
statuses
.
latest
.
status
@status
||=
statuses
.
latest
.
status
end
end
def
statuses
def
statuses
pipeline
.
statuses
.
where
(
stage:
stage
)
@statuses
||=
pipeline
.
statuses
.
where
(
stage:
stage
)
end
end
def
builds
def
builds
pipeline
.
builds
.
where
(
stage:
stage
)
@builds
||=
pipeline
.
builds
.
where
(
stage:
stage
)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment