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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9e78b86d
Commit
9e78b86d
authored
May 02, 2018
by
blackst0ne
Committed by
Rémy Coutable
May 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Rails5] Fix enum question mark methods
parent
1350d80c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+11
-0
app/models/commit_status.rb
app/models/commit_status.rb
+7
-0
No files found.
app/models/ci/pipeline.rb
View file @
9e78b86d
...
@@ -530,6 +530,17 @@ module Ci
...
@@ -530,6 +530,17 @@ module Ci
@latest_builds_with_artifacts
||=
builds
.
latest
.
with_artifacts_archive
.
to_a
@latest_builds_with_artifacts
||=
builds
.
latest
.
with_artifacts_archive
.
to_a
end
end
# Rails 5.0 autogenerated question mark enum methods return wrong result if enum value is nil.
# They always return `false`.
# These methods overwrite autogenerated ones to return correct results.
def
unknown?
Gitlab
.
rails5?
?
source
.
nil?
:
super
end
def
unknown_source?
Gitlab
.
rails5?
?
config_source
.
nil?
:
super
end
private
private
def
ci_yaml_from_repo
def
ci_yaml_from_repo
...
...
app/models/commit_status.rb
View file @
9e78b86d
...
@@ -189,4 +189,11 @@ class CommitStatus < ActiveRecord::Base
...
@@ -189,4 +189,11 @@ class CommitStatus < ActiveRecord::Base
v
=~
/\d+/
?
v
.
to_i
:
v
v
=~
/\d+/
?
v
.
to_i
:
v
end
end
end
end
# Rails 5.0 autogenerated question mark enum methods return wrong result if enum value is nil.
# They always return `false`.
# This method overwrites the autogenerated one to return correct result.
def
unknown_failure?
Gitlab
.
rails5?
?
failure_reason
.
nil?
:
super
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