aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/attribute_methods.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2017-04-14 10:46:07 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2017-04-14 10:53:47 -0700
commit83d6cc4815debe2086073387ecbf38c0f47cfec5 (patch)
treeabde4f8ae9236998c617aa1ccfb31e72665a8960 /activemodel/lib/active_model/attribute_methods.rb
parente447c8c80a3f99a29286661eb47762535c249181 (diff)
downloadrails-83d6cc4815debe2086073387ecbf38c0f47cfec5.tar.gz
rails-83d6cc4815debe2086073387ecbf38c0f47cfec5.tar.bz2
rails-83d6cc4815debe2086073387ecbf38c0f47cfec5.zip
Move around AR::Dirty and fix _attribute method
We already have a _read_attribute method that can get the value we need from the model. Lets define that method in AM::Dirty and use the existing one from AR::Dirty rather than introducing a new method.
Diffstat (limited to 'activemodel/lib/active_model/attribute_methods.rb')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index 166c6ac21f..b5c0b43b61 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -472,5 +472,9 @@ module ActiveModel
def missing_attribute(attr_name, stack)
raise ActiveModel::MissingAttributeError, "missing attribute: #{attr_name}", stack
end
+
+ def _read_attribute(attr)
+ __send__(attr)
+ end
end
end