def users
[user_n, user_e, user_s, user_w]
end
end
What I'm trying to do is to return something similar to
AssociationProxy in the method users. I see no point of creating many-
to-many association here - the only thing that I want to achieve is:
board.users.owner(card) # returns user that owns given card
I've spent some time on analysing AssociationProxy class, and I think
it's possible to decouple general Proxy class from it. It'd be really
nice to implement the "users" method like:
def users
ActiveSupport::Proxy.new([user_n, user_e, user_s, user_w]) do
def owner(card)
...
end
end
end
I can try to write something, but I'd like to know if it's worth
spending few hours on it. What do you think about it?
But I need to access the parent (Board) class from the extension
method. Probably I could use the JS version: to define that = self
before the definition. Anyway - it'd be really great to have Proxy
class in ActiveSupport I think.