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
|
||||
name = reflection.name
|
||||
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
||||
unless defined? #{name}_id
|
||||
def #{name}_id
|
||||
association(:#{name}).reader.try(:id)
|
||||
end
|
||||
def #{name}_id
|
||||
# if an attribute is already defined with this methods name we should just use it
|
||||
return read_attribute(__method__) if has_attribute?(__method__)
|
||||
association(:#{name}).reader.try(:id)
|
||||
end
|
||||
CODE
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user