diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-31 17:25:45 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-07 13:51:52 -0800 |
commit | 9bcb9cd55f92fb0252b3ab93d068e0b336727af0 (patch) | |
tree | 16c0f44755b2736b14087924daf6a4746cbf8160 /activerecord/lib/active_record/inheritance.rb | |
parent | 9c07e389be340e4d25298148cf39d10218ffb1a0 (diff) | |
download | rails-9bcb9cd55f92fb0252b3ab93d068e0b336727af0.tar.gz rails-9bcb9cd55f92fb0252b3ab93d068e0b336727af0.tar.bz2 rails-9bcb9cd55f92fb0252b3ab93d068e0b336727af0.zip |
column types are passed from the result set to the instantiated AR object
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r-- | activerecord/lib/active_record/inheritance.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index eaa7deac5a..1f5b3b2e79 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -62,7 +62,7 @@ module ActiveRecord # Finder methods must instantiate through this method to work with the # single-table inheritance model that makes it possible to create # objects of different types from the same table. - def instantiate(record) + def instantiate(record, column_types = {}) sti_class = find_sti_class(record[inheritance_column]) record_id = sti_class.primary_key && record[sti_class.primary_key] @@ -77,7 +77,8 @@ module ActiveRecord IdentityMap.add(instance) end else - instance = sti_class.allocate.init_with('attributes' => record) + instance = sti_class.allocate.init_with('attributes' => record, + 'column_types' => column_types) end instance |