BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1058973f
Commit
1058973f
authored
May 30, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rails5-boolean-cast' into 'master'
Fix boolean casting for nil value Closes #46925 See merge request gitlab-org/gitlab-ce!19202
parents
a51c5773
884fbf1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
service.rb
app/models/service.rb
+3
-2
No files found.
app/models/service.rb
View file @
1058973f
...
...
@@ -206,10 +206,11 @@ class Service < ActiveRecord::Base
args
.
each
do
|
arg
|
class_eval
%{
def #{arg}?
# '!!' is used because nil or empty string is converted to nil
if Gitlab.rails5?
!
ActiveModel::Type::Boolean::FALSE_VALUES.include?
(#{arg})
!
!ActiveRecord::Type::Boolean.new.cast
(#{arg})
else
ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?
(#{arg})
!!ActiveRecord::Type::Boolean.new.type_cast_from_database
(#{arg})
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