Commit 432e57fc authored by blackst0ne's avatar blackst0ne

[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
parent aade8b36
......@@ -206,8 +206,12 @@ class Service < ActiveRecord::Base
args.each do |arg|
class_eval %{
def #{arg}?
if Gitlab.rails5?
!ActiveModel::Type::Boolean::FALSE_VALUES.include?(#{arg})
else
ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(#{arg})
end
end
}
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment