diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-04-08 01:48:38 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-04-08 01:48:38 +0300 |
commit | 432e57fccfcc854f8aedc578111c1d4a6b0f4a2d (patch) | |
tree | a1df66d1ad075edb687a74b90269758a176fbe8e | |
parent | aade8b3652573db40e7b777c72caa922b0bc12ef (diff) |
[Rails5] Add FALSE_VALUES constant to Service#boolean_accessor
In Rails 5.0 the `ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES`
constant has been removed [1] and the remaining `FALSE_VALUES` constant
has been moved to `ActiveModel::Type::Boolean` [2]
[1]: https://github.com/rails/rails/commit/a502703c3d2151d4d3b421b29fefdac5ad05df61
[2]: https://github.com/rails/rails/commit/9cc8c6f3730df3d94c81a55be9ee1b7b4ffd29f6
-rw-r--r-- | app/models/service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/service.rb b/app/models/service.rb index e9b6f005aec..f7e3f7590ad 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -206,7 +206,11 @@ class Service < ActiveRecord::Base args.each do |arg| class_eval %{ def #{arg}? - ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(#{arg}) + if Gitlab.rails5? + !ActiveModel::Type::Boolean::FALSE_VALUES.include?(#{arg}) + else + ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(#{arg}) + end end } end |