You might try changing the accessible => true to your join table.  You
have to do a little tweaking to get the unneeded belongs_to
association select(s) out but then you get the input-many along with
the subtype selection (admin, etc.).

This is assuming you can handle getting the view (show, index) part
down but that's pretty simple.

On Sep 2, 4:28 am, MartOn <[email protected]> wrote:
> Sorry for my terrible English in previous post. I did not read it
> through before sending, "what I mean" :-)
> /MartOn
>
> On Sep 2, 12:25 pm, MartOn <[email protected]> wrote:
>
> > That was my intention to use scopes, but I could not get hobo to work
> > with assignments of these roles. That means I have to code that
> > manually in DRYML and I do not know dryml that well. It means that
> > doing it in just Rails is faster for me. With the scopes I was hoping
> > also that when I edit a club that have these named scopes (like shown
> > in my first post). What I mean is that I was hoping the Club edit form
> > generated from hobo then would have one attribute for regular members,
> > club admins and powerusers. Then you could assign this easily without
> > doing alot of coding.
>
> > I just thought about maybe creating virtual attributes. Not sure if
> > this solves it, but at least that could maybe be a solution and force
> > hobo to use "has_many" presentation for it and add the before_filter
> > that assign these users on save.
>
> > Ideas?
> > This must be common issue, sice  these kinds of relation-ships
> > basically can be used all over the place, not just for memberships.
> > Its more a RESTful approach.
>
> > /MartOn
>
> > On Sep 1, 8:06 pm, kevinpfromnm <[email protected]> wrote:
>
> > > Right, but if you've got the information about the role in the join
> > > table, and each of your members, powerusers, and admins are just a
> > > flag in the join table, why not just have a named scope that returns
> > > just the admins or just the powerusers etc rather than a whole new
> > > association?
>
> > > On Sep 1, 5:08 am, MartOn <[email protected]> wrote:
>
> > > > 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