Getting the right HTML for Rails Nested Model Forms
November 10, 2009
Filed under Rails problem solving
Tags: delete, hidden input, nested model forms, nested models, rails, ruby
Last week I had trouble getting Rails’s Nested Model Forms feature to work for me in exactly the way I wanted. Two things were working against me: 1) No documentation that shows the complete process for nested models from ERB to HTML, to HTTP parameters, to controller code. and 2) Blogs and suggestions I came up with were close, but didn’t work.
Since I was using javascript rather than ERB to create the hidden input tags in the HTML, I needed to know exactly how to construct my tags to tell rails what to do with my nested models. (Read More)