From 432e57fccfcc854f8aedc578111c1d4a6b0f4a2d Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Sun, 8 Apr 2018 09:48:38 +1100 Subject: [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 --- app/models/service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1