aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index eaa7deac5a..2c766411a0 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,9 @@ module ActiveRecord
IdentityMap.add(instance)
end
else
- instance = sti_class.allocate.init_with('attributes' => record)
+ column_types = sti_class.decorate_columns(column_types)
+ instance = sti_class.allocate.init_with('attributes' => record,
+ 'column_types' => column_types)
end
instance