提交 432e57fc 编写于 作者: B 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
上级 aade8b36
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册