second attempt to fix the has one name collision issue
This commit is contained in:
parent
901801fa80
commit
c943683141
@ -9,10 +9,10 @@ if defined?(::ActiveRecord)
|
|||||||
super
|
super
|
||||||
name = reflection.name
|
name = reflection.name
|
||||||
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
||||||
unless defined? #{name}_id
|
def #{name}_id
|
||||||
def #{name}_id
|
# if an attribute is already defined with this methods name we should just use it
|
||||||
association(:#{name}).reader.try(:id)
|
return read_attribute(__method__) if has_attribute?(__method__)
|
||||||
end
|
association(:#{name}).reader.try(:id)
|
||||||
end
|
end
|
||||||
CODE
|
CODE
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user