handle id attribute in PrimaryKey module

This commit is contained in:
Sergey Nartimov 2012-02-11 22:03:07 +03:00
parent 347e0a6033
commit d7942d4230
2 changed files with 7 additions and 1 deletions

@ -244,7 +244,7 @@ def arel_attributes_values(include_primary_key = true, include_readonly_attribut
end
def attribute_method?(attr_name)
attr_name == 'id' || (defined?(@attributes) && @attributes.include?(attr_name))
defined?(@attributes) && @attributes.include?(attr_name)
end
end
end

@ -24,6 +24,12 @@ def id?
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