Merge pull request #5006 from lest/patch-1
handle id attribute in PrimaryKey module
This commit is contained in:
commit
5138a8f254
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user