aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-05-20 10:33:50 +0200
committerYves Senn <yves.senn@gmail.com>2014-05-20 10:37:17 +0200
commit60bd2432b2f1fa5a84554aea38b8971368b79cfe (patch)
treed5868041e7ccb1c12141b89cc9b0cfd5a246435a /activerecord/lib/active_record/persistence.rb
parent7591e8c1a752c92091225c3b8503ea31453af595 (diff)
downloadrails-60bd2432b2f1fa5a84554aea38b8971368b79cfe.tar.gz
rails-60bd2432b2f1fa5a84554aea38b8971368b79cfe.tar.bz2
rails-60bd2432b2f1fa5a84554aea38b8971368b79cfe.zip
docs, `instantiate` expects `String` keys. [Rafal Piekarski & Yves Senn]
Closes #15122 Closes #15107
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 13d7432773..b74e340b3e 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -37,7 +37,7 @@ module ActiveRecord
end
# Given an attributes hash, +instantiate+ returns a new instance of
- # the appropriate class.
+ # the appropriate class. Accepts only keys as strings.
#
# For example, +Post.all+ may return Comments, Messages, and Emails
# by storing the record's subclass in a +type+ attribute. By calling
@@ -46,10 +46,10 @@ module ActiveRecord
#
# See +ActiveRecord::Inheritance#discriminate_class_for_record+ to see
# how this "single-table" inheritance mapping is implemented.
- def instantiate(record, column_types = {})
- klass = discriminate_class_for_record(record)
+ def instantiate(attributes, column_types = {})
+ klass = discriminate_class_for_record(attributes)
column_types = klass.decorate_columns(column_types.dup)
- klass.allocate.init_with('attributes' => record, 'column_types' => column_types)
+ klass.allocate.init_with('attributes' => attributes, 'column_types' => column_types)
end
private