Displaying 1 result from an estimated 1 matches for "personproxy".
2008 Nov 19
3
Overwriting / Decorating ActiveRecord association accessor
Hi,
I am trying to overwrite the accessor of a has_many association.
Basically my class looks like this:
class Person
has_many :emails
has_one :link, :class_name => ''PersonProxy''
def emails_with_link
link.emails + emails_without_link
end
alias_method_chain :emails, :link
end
Now that works fine if I only access the collection like
>> Person.find(1).emails
=> [#<Email...]
But using any collection specific methods throw a NoMethodError
>...