lib/adaptive_alias/patches/base.rb in adaptive_alias-1.2.1 vs lib/adaptive_alias/patches/base.rb in adaptive_alias-1.3.0
- old
+ new
@@ -67,21 +67,21 @@
fix_arel_attributes.call(node.left)
fix_arel_attributes.call(node.right)
end
end
- @check_matched = proc do |relation, reflection, model, error|
+ @check_matched = proc do |relation, reflection, model_klass, error|
next false if not patch.removable
# Error highlight behavior in Ruby 3.1 pollutes the error message
error_msg = error.respond_to?(:original_message) ? error.original_message : error.message
ambiguous = expected_ambiguous_association_err_msgs.include?(error_msg)
if ambiguous
next false if relation and klass.table_name != relation.klass.table_name
next false if reflection and klass.table_name != reflection.klass.table_name
- next false if model and klass.table_name != model.class.table_name
- next false if !relation and !reflection and !model
+ next false if model_klass and klass.table_name != model_klass.table_name
+ next false if !relation and !reflection and !model_klass
end
next false if not expected_association_err_msgs.include?(error_msg) and not ambiguous
next true
end