diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-11 23:35:57 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-11 23:35:57 +0900 |
commit | 82ac7555ab69c1ae11360d2b9bd8dfd723a13485 (patch) | |
tree | 17194d8409c52cfaddc6b373915496a9d2d6d6f9 /activerecord | |
parent | 538b19c47eadc43c923527d7c0a4caa66b5cda7e (diff) | |
download | rails-82ac7555ab69c1ae11360d2b9bd8dfd723a13485.tar.gz rails-82ac7555ab69c1ae11360d2b9bd8dfd723a13485.tar.bz2 rails-82ac7555ab69c1ae11360d2b9bd8dfd723a13485.zip |
Don't expose `instantiate_instance_of` for internal use
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 24af56cf0b..6eb2bfb452 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -70,17 +70,6 @@ module ActiveRecord instantiate_instance_of(klass, attributes, column_types, &block) end - # Given a class, an attributes hash, +instantiate_instance_of+ returns a - # new instance of the class. Accepts only keys as strings. - # - # This is private, don't call it. :) - # - # :nodoc: - def instantiate_instance_of(klass, attributes, column_types = {}, &block) - attributes = klass.attributes_builder.build_from_database(attributes, column_types) - klass.allocate.init_from_db(attributes, &block) - end - # Updates an object (or multiple objects) and saves it to the database, if validations pass. # The resulting object is returned whether the object was saved successfully to the database or not. # @@ -216,6 +205,13 @@ module ActiveRecord end private + # Given a class, an attributes hash, +instantiate_instance_of+ returns a + # new instance of the class. Accepts only keys as strings. + def instantiate_instance_of(klass, attributes, column_types = {}, &block) + attributes = klass.attributes_builder.build_from_database(attributes, column_types) + klass.allocate.init_from_db(attributes, &block) + end + # Called by +instantiate+ to decide which class to use for a new # record instance. # |