here is an example of some code I use to downselect users so that they
do not get the same permission twice
def options_for_association_conditions(association)
if association.name == :user && @record.permission
#remove users that already have the permission from the
user
dropdown list
user_ids = User.find(:all, :conditions => {:ned_active
=>
1}).collect(&:id) - @record.permission.users.collect(&:id)
{:conditions => {'users.id' => user_ids}}
else
super
end
end
On Nov 7, 12:35 pm, Soren Christensen <[email protected]> wrote:
> Hi,
>
> I have a set of relations where I use a conditions_for_collections to control
> what is happening.
>
> When I create a new item through the nested relation I get all of the items
> in the nested model, and not the ones filtered through the
> conditions_through_collection.
>
> Do I need to move by filter into the actual model association as a :condition
> there, or is there an AS structure that I should use instead ?
>
> /S
--
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.