aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-02-11 11:14:00 -0800
committerXavier Noria <fxn@hashref.com>2012-02-11 11:14:00 -0800
commit5138a8f254b865c2cf97b61848b640783366d26b (patch)
treeccacb2cb9d1f889e135ac6487fae227f994a266b /activerecord/lib/active_record/attribute_methods
parent347e0a603308f1936d995ad0e7966e1de071e75f (diff)
parentd7942d4230e7cfa0c0c7c96c9a10dee49f612155 (diff)
downloadrails-5138a8f254b865c2cf97b61848b640783366d26b.tar.gz
rails-5138a8f254b865c2cf97b61848b640783366d26b.tar.bz2
rails-5138a8f254b865c2cf97b61848b640783366d26b.zip
Merge pull request #5006 from lest/patch-1
handle id attribute in PrimaryKey module
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/primary_key.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb
index 7c59664703..2e1a2dc3ef 100644
--- a/activerecord/lib/active_record/attribute_methods/primary_key.rb
+++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb
@@ -24,6 +24,12 @@ module ActiveRecord
query_attribute(self.class.primary_key)
end
+ protected
+
+ def attribute_method?(attr_name)
+ attr_name == 'id' || super
+ end
+
module ClassMethods
def define_method_attribute(attr_name)
super