Overloading association methods
Does anyone know if there is a way to overload an association accessor method and not the s开发者_开发问答etter?
For example
class Bar
has_many :users
def users
'foo'
end
end
a = Bar.new
a.users # => 'foo'
a.users << bob => [bob]
Hope that makes sense.
Ok can't do it.
I'm overloading the method that accesses the association proxy object.
Oh well live an learn.
精彩评论