I changed it to STI and got it working better, but not perfect :-)

what I want is just a rolebased relationship between to models.
So a user can have different roles in a club. For instance Manager,
trainer, player, etc.
The membership table can now also track hustory, thats why I do not
have the role as a has_one from the club to user.

BR
MartOn

On Aug 31, 7:42 pm, kevinpfromnm <[email protected]> wrote:
> Do you want another relationship or just a named scope for this?
>
> On Aug 31, 3:24 am, MartOn <[email protected]> wrote:
>
> > Hello
> > I am setting up a membership relation to the users table like this:
>
> > # this is the main relasionship were all realtions are stored
> > has_many :memberships, :class_name => "ClubMembership", :dependent
> > => :destroy
> > has_many :members, :through => :memberships, :source
> > => :user, :accessible => true
>
> > Then I have these conditional relations made:
>
> >   # club admins
> >   has_many :club_admin_members, :class_name =>
> > "ClubMembership", :conditions => {:club_administrator => true}
> >   has_many :club_admins, :through => :club_admin_members, :source
> > => :user, :accessible => true
>
> >   # club powerusers
> >   has_many :club_power_members, :class_name =>
> > "ClubMembership", :conditions => {:club_poweruser => true}
> >   has_many :club_powerusers, :through => :club_power_members, :source
> > => :user
>
> > But the :accessible => true does not work for these :-(
> > I will get an SQL error.
> > Probably because it needs to set the condition correct when you add
> > users.
>
> > does anyone have a DRY way of adding support for this to my form?
>
> > /Frode
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to