I am following the Rails guide for doing multi-model nested form. I have 2 models, Page and Picture. Page has_many Pictures. I’m putting the Picture file field within the Edit Page form using fields_for.
Each time I upload an image, the form will add an additional file field to allow for a new Picture to be uploaded.
The behavior I want is for the Page form to only always have one file field which will create a new Picture. I don’t need previous pictures to be editable.
The questions thus are 1) how can I do the above? 2) should I even be using nested form? Because I’m not editing other parts of the Page when creating a picture.
You can just use:
Or you can place form wherever you want and send it to pictures controller: