diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-05-21 10:46:28 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-21 10:46:28 +0100 |
commit | 19d7b1d22bd68af00244ddc3e1f35cec187e9120 (patch) | |
tree | 8fce3b227619c62a1a571b542d19dfa72846ab09 | |
parent | 281edce6db8accc7d4a0e9ab01892631d9d0ebc3 (diff) | |
download | rails-19d7b1d22bd68af00244ddc3e1f35cec187e9120.tar.gz rails-19d7b1d22bd68af00244ddc3e1f35cec187e9120.tar.bz2 rails-19d7b1d22bd68af00244ddc3e1f35cec187e9120.zip |
Verbose ActiveRecord::AssociationTypeMismatch exception message. [#189 state:resolved]
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index ec16af3897..11c64243a2 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -210,7 +210,8 @@ module ActiveRecord def raise_on_type_mismatch(record) unless record.is_a?(@reflection.klass) - raise ActiveRecord::AssociationTypeMismatch, "#{@reflection.klass} expected, got #{record.class}" + message = "#{@reflection.class_name}(##{@reflection.klass.object_id}) expected, got #{record.class}(##{record.class.object_id})" + raise ActiveRecord::AssociationTypeMismatch, message end end |