Skip to content

Commit

Permalink
Check that class responds to mobility_attribute?
Browse files Browse the repository at this point in the history
  • Loading branch information
borisrorsvort authored and shioyama committed Jun 24, 2022
1 parent 516e19f commit 8af0306
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/mobility/plugins/active_record/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ def order(opts, *rest)
define_method method_name do |*attrs, &block|
return super(*attrs, &block) if (method_name == 'select' && block.present?)

if ::ActiveRecord::VERSION::STRING < '7.0'
return super(*attrs, &block) unless @klass.respond_to?(:mobility_attribute?)
end
return super(*attrs, &block) unless @klass.respond_to?(:mobility_attribute?)

return super(*attrs, &block) unless attrs.any?(&@klass.method(:mobility_attribute?))

keys = attrs.dup
Expand Down

0 comments on commit 8af0306

Please sign in to comment.