diff options
author | Akira Matsuda <ronnie@dio.jp> | 2019-07-31 09:51:41 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2019-07-31 12:18:44 +0900 |
commit | 6dbfc6773472c8a503b2a9ab2b9a4c6af6bc4eef (patch) | |
tree | 61574bb8411fbb5ba6ca3d0ff7740295dac169d0 /activerecord/lib | |
parent | 46d207fde47f7db810e7b1fcc1ba20094ec28824 (diff) | |
download | rails-6dbfc6773472c8a503b2a9ab2b9a4c6af6bc4eef.tar.gz rails-6dbfc6773472c8a503b2a9ab2b9a4c6af6bc4eef.tar.bz2 rails-6dbfc6773472c8a503b2a9ab2b9a4c6af6bc4eef.zip |
Accessing ivar with Symbols might be just a very little bit better than with fstrings
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 323b01ab2d..4dfe8655fe 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -566,10 +566,10 @@ module ActiveRecord def becomes(klass) became = klass.allocate became.send(:initialize) - became.instance_variable_set("@attributes", @attributes) - became.instance_variable_set("@mutations_from_database", @mutations_from_database ||= nil) - became.instance_variable_set("@new_record", new_record?) - became.instance_variable_set("@destroyed", destroyed?) + became.instance_variable_set(:@attributes, @attributes) + became.instance_variable_set(:@mutations_from_database, @mutations_from_database ||= nil) + became.instance_variable_set(:@new_record, new_record?) + became.instance_variable_set(:@destroyed, destroyed?) became.errors.copy!(errors) became end @@ -809,7 +809,7 @@ module ActiveRecord self.class.unscoped { self.class.find(id) } end - @attributes = fresh_object.instance_variable_get("@attributes") + @attributes = fresh_object.instance_variable_get(:@attributes) @new_record = false self end |