Wednesday 11 November 2009

Nested polymorphic associations

My ears are bleeding ...

Slowly getting there, but lordy-oh-lordy nested polymorphism is tricky stuff : things like this
form_for [@job, @batchable, @batch] do |f|

in order to generate the correct form for a URL like this
/jobs/18921/scannings/1/batches/1/edit

We have batches which are either photographic, or scans. They belong to jobs. There is a polymorphic relationship (batchable) between them all.
Then nest all of that inside the jobs so that you only get the batches that belong to a particular job. Fun for all the family...

No comments:

Post a Comment