Thursday 12 November 2009

Nested polymorphic associations - 2

Have fought through the undergrowth and am in a clearing - and I can see the way out.
The most important thing is to pay close attention to what
rake routes

tells you. And if you have a job_scannings_batches path - remember to give the objects in the correct order. Rails may be smart, but it isn't that smart.
Have a kludge in place to get the second layer of nesting to work - not sure it is very elegant, but it works. I get the name of the polymorphically associated class and use that to do a custom search
(ie @batchable.Class.name). I can't help but feel I should be able to do it using an association of some kind. However it works so ... (but it feels bad)

No comments:

Post a Comment