Hi All If I understand correctly there are currently two ways to control the set of records that the list action gets:
1. Constraints Pass a constraints hash to the render method. This is limited to "equals only" on database fields of the primary object (not associated objects). 2. conditions_for_collections Define a methods called conditions_for_collections. This allows for ActiveRecord style "conditions" (using either string or array syntax) but is also limited to database fields of the primary object. I have a situation that I believe calls for slightly more control - maybe somebody has some ideas. Assume that I have the following associated models: Supplier -> Master User -> Master Allocation -> Supplier Allocation -> User (Allocation is the "many-to-many" between Supplier and User, Supplier and User both belong to Master). Using ActiveRecord, if I have Supplier logged in and I want to display his Users (which he is associated to via Allocations) I can use the a combination of the :joins and :conditions clauses on the "find method" to join User to Supplier (through Allocation) and retrieve the relevant User records. To do this in ActiveScaffold, a colleague has suggested building up an array of the relevant ids and then creating an "IN" condition passing in the array of ids (for example ['id IN (?)', array_of_ids]). This seems particularly kludgy and will also be quite non-performant as the count of ids grows. Is there a more elegant way to do this in ActiveScaffold? Any suggestions would be most welcome. Thanks Regards, Tony --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
