diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-11-10 14:02:28 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-11-10 14:02:28 +0900 |
commit | 7d862ffb6265fe889635e2f8311261a4a37702f1 (patch) | |
tree | 2a5523bc813e466f49d1d1234cf499fc93050793 /activemodel | |
parent | 8c7967c9b916fe625e7ce10591b101abde3be4f5 (diff) | |
download | rails-7d862ffb6265fe889635e2f8311261a4a37702f1.tar.gz rails-7d862ffb6265fe889635e2f8311261a4a37702f1.tar.bz2 rails-7d862ffb6265fe889635e2f8311261a4a37702f1.zip |
Fix "warning: instance variable @attributes not initialized"
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/dirty.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index ddd93e34a6..d2ebd18107 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -257,7 +257,7 @@ module ActiveModel unless defined?(@mutations_from_database) @mutations_from_database = nil end - @mutations_from_database ||= if @attributes + @mutations_from_database ||= if defined?(@attributes) ActiveModel::AttributeMutationTracker.new(@attributes) else NullMutationTracker.instance @@ -265,7 +265,7 @@ module ActiveModel end def forget_attribute_assignments - @attributes = @attributes.map(&:forgetting_assignment) if @attributes + @attributes = @attributes.map(&:forgetting_assignment) if defined?(@attributes) end def mutations_before_last_save |