diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 02:08:42 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 02:08:42 +0530 |
commit | 468cfcedd311a428339fa01e5f62b935f2995ec0 (patch) | |
tree | e778390a16039e3b847daae7afea4cdbdf8a634f /activerecord/lib | |
parent | 7f8d4d3c4ed82a90f94251438d61d395a544026c (diff) | |
download | rails-468cfcedd311a428339fa01e5f62b935f2995ec0.tar.gz rails-468cfcedd311a428339fa01e5f62b935f2995ec0.tar.bz2 rails-468cfcedd311a428339fa01e5f62b935f2995ec0.zip |
Improve the error message for class mismatch on Relation#merge
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/spawn_methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 33df8fd06c..f4abaae43e 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -15,7 +15,9 @@ module ActiveRecord end def merge(r) - raise ArgumentError, "Cannot merge a #{r.klass.name} relation with #{@klass.name} relation" if r.klass != @klass + if r.klass != @klass + raise ArgumentError, "Cannot merge a #{r.klass.name}(##{r.klass.object_id}) relation with #{@klass.name}(##{@klass.object_id}) relation" + end merged_relation = spawn.eager_load(r.eager_load_values).preload(r.preload_values).includes(r.includes_values) |