aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-11-10 17:48:23 +0900
committerGitHub <noreply@github.com>2017-11-10 17:48:23 +0900
commit2da92b7a94fc3f3e524e1becc600bd1f63a361fd (patch)
tree8b23eeabf9d53f1315a13fe0b37a3bf5bee246d8 /activemodel/lib
parentfc2abdb23982fa838c55723a430a4cd2c9894ce9 (diff)
parent5ed618e192e9788094bd92c51255dda1c4fd0eae (diff)
downloadrails-2da92b7a94fc3f3e524e1becc600bd1f63a361fd.tar.gz
rails-2da92b7a94fc3f3e524e1becc600bd1f63a361fd.tar.bz2
rails-2da92b7a94fc3f3e524e1becc600bd1f63a361fd.zip
Merge pull request #31114 from y-yagi/fix_ruby_warnings_in_active_model
Fix ruby warnings in Active Model
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/attributes.rb2
-rw-r--r--activemodel/lib/active_model/dirty.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/attributes.rb b/activemodel/lib/active_model/attributes.rb
index 13cad87875..6f84748804 100644
--- a/activemodel/lib/active_model/attributes.rb
+++ b/activemodel/lib/active_model/attributes.rb
@@ -77,7 +77,7 @@ module ActiveModel
attr_name.to_s
end
- @attributes.write_from_user(attr_name.to_s, value)
+ @attributes.write_from_user(name, value)
value
end
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