This is a bit disorderly (chortle chortle) and messes up some other stuff I've been playing with so I'd like preloading to do something a lot closer to what happens if the association is loaded normally. There are a fair few cases to consider (polymorphic associations and the plethora of options you can set) which was probably why I originally wrote it the way it is now. It would be great to share the code with has many through as this should help stop the two diverging. As I said it's a fair chunk of code. It's currently broken up into several bits (construct_joins, construct_conditions etc...), would an acceptable path be to pull that out into something which either takes a single owner (ie produces WHERE foo_id= x) or (the preload case) an array of orders which both the association and the preload code would call?
Opinions much appreciated, Fred
smime.p7s
Description: S/MIME cryptographic signature
