Is there a problem with this solution?
On Sun, Mar 22, 2009 at 2:27 PM, Wes Gamble <[email protected]> wrote:
>
> Wes Gamble wrote:
> > All,
> >
> > I have a model X which is HABTM to a model Y.
> >
> > I want to be able to limit the the display of x's based on a value of Y.
> >
> > So, for example, let's say that there are 50000 x's. But only 10000 of
> > them relate to a specific value of Y via the HABTM.
> >
> > How can I take in a value of Y (via a param) and then effectively use it
> > to filter the "list" display of X to only show the appropriate 10000
> > records (as opposed to all 50000).
> >
> My current solution is to add the following condition to
> conditions_for_collection:
>
> "id IN (SELECT X_id FROM join_table WHERE Y_id = #{value of Y})"
>
> W
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---