aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-04-27 15:53:36 +0200
committerYves Senn <yves.senn@gmail.com>2015-04-27 15:57:24 +0200
commit71308becfeef0e5d5fd4f91f95f8b11a23c3f4d4 (patch)
treea02f68e39514e5260e7c6ab40cec4673dfae5d6b /activerecord/lib/active_record/persistence.rb
parent6d9ad0dd921e3368b64910c5aeebb880bc8c41a3 (diff)
parent4a8f0816db3a2f3709a61a266280c51ead434d58 (diff)
downloadrails-71308becfeef0e5d5fd4f91f95f8b11a23c3f4d4.tar.gz
rails-71308becfeef0e5d5fd4f91f95f8b11a23c3f4d4.tar.bz2
rails-71308becfeef0e5d5fd4f91f95f8b11a23c3f4d4.zip
Merge pull request #19918 from vngrs/becomes_missing_note_about_sti
Add note about sti column value to becomes method [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index ae1c326d95..dac35d7741 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -205,7 +205,9 @@ module ActiveRecord
# instance using the companies/company partial instead of clients/client.
#
# Note: The new instance will share a link to the same attributes as the original class.
- # So any change to the attributes in either instance will affect the other.
+ # Therefore the sti column value will still be the same.
+ # Any change to the attributes on either instance will affect both instances.
+ # If you want to change the sti column as well, use +becomes!+ instead.
def becomes(klass)
became = klass.new
became.instance_variable_set("@attributes", @attributes)