Permalink
Browse files

Display value when raising due to unscope() issues

Hopefully make it easier to debug errors. e.g

Before:

    RuntimeError:
       unscope(where: "deleted_at") failed: unscoping String is unimplemented.

After:

    RuntimeError:
       unscope(where: "deleted_at") failed: unscoping String "'t'='t'" is unimplemented.
  • Loading branch information...
1 parent dd339bb commit 8b14b114348c1bf8a88689028e25240d457dff56 @huoxito huoxito committed Jan 27, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/query_methods.rb
@@ -877,7 +877,7 @@ def where_unscoping(target_value)
subrelation = (rel.left.kind_of?(Arel::Attributes::Attribute) ? rel.left : rel.right)
subrelation.name == target_value
else
- raise "unscope(where: #{target_value.inspect}) failed: unscoping #{rel.class} is unimplemented."
+ raise "unscope(where: #{target_value.inspect}) failed: unscoping #{rel.class} \"#{rel}\" is unimplemented."
end
end

0 comments on commit 8b14b11

Please sign in to comment.