Hi,

I tried this in activerecord and it was a real problem to get it
right.
I think sequel will make this easier.

simple problem:
Group habtm User
User habtm Group

join model is named Membership.

say I gave group g.
g.users should return a list of users for that group (works out of the
box),
but I want the User instances to know/cache the membership record that
was used to get to them from g.
So I can get users to display stuff about their membership to g (since
when, status) without having to do a new query for them.

Now, I know I can also fetch g's memberships and eager load the user,
but I would like this the other way around, so I can still use filters
and such on users.

>From an OO-perspective it's a bit odd, but I would like all user
instances (fetched through this association) to have a
'membership' (singular) attribute that caches the membership used to
get to self. This might be a bit strange since users already have
'memberships' (plural).

Is something like this possible using sequel?
Or would it be a dirty hack?

Thanks,
Mathijs

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to