diff options
author | Lawrence Pit <lawrence.pit@gmail.com> | 2008-10-04 15:31:04 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-04 17:49:38 +0100 |
commit | 7659fb6a2b638703a99a63033d947d19089a6b85 (patch) | |
tree | 8fd60cdb04a6185be763433d0dfa9741972c70c7 /activerecord/lib/active_record/associations | |
parent | b437a7d34e86c16a211171d491e805b603f0dc99 (diff) | |
download | rails-7659fb6a2b638703a99a63033d947d19089a6b85.tar.gz rails-7659fb6a2b638703a99a63033d947d19089a6b85.tar.bz2 rails-7659fb6a2b638703a99a63033d947d19089a6b85.zip |
Try reloading model on class mismatch [#229 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index acdcd14ec8..b617147f67 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -240,7 +240,7 @@ module ActiveRecord # the kind of the class of the associated objects. Meant to be used as # a sanity check when you are about to assign an associated record. def raise_on_type_mismatch(record) - unless record.is_a?(@reflection.klass) + unless record.is_a?(@reflection.klass) || record.is_a?(@reflection.class_name.constantize) message = "#{@reflection.class_name}(##{@reflection.klass.object_id}) expected, got #{record.class}(##{record.class.object_id})" raise ActiveRecord::AssociationTypeMismatch, message end |