On Domingo, 14 de Febrero de 2010 20:16:35 Soren escribió:
> Hi,
>
> Have a HABTM model describing some users that are members of a
> particular group.
>
> Would love to use an embedded scaffold to produce a members list.
>
> But I can not seem to grasp how to build this correctly.
>
> Has anyone gotten this to work, and can share how to do this ?
>
> model/users.rb:
>   has_and_belongs_to_many :groups
>
> model/group.rb:
>   has_and_belongs_to_many :users
>
> views/groups/group_roster.html.erb:
>
>   <%= render  :active_scaffold => "Users" %>
>
> But this lists everybody, not the ones in the particular group.

You must set the constraints (or conditions), but I don't have experience with 
embedded scaffold so I don't know the syntax.

>
>
> And what if I would like to make a list of all users, and their
> associated groups - but only listing those that are members of
> groups ?

You can restrict it with conditions_for_collection, or adding conditions to 
embedded scaffold rendering. Look at wiki about embedded scaffold or wait 
someone using embedded scaffold tells you how to set constraints or conditions, 
I have never used it.

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to