I am trying to achieve a subsequent form submission. To clarify things –
- I submit a form for @post
- then once that @post is created I would immediately (under the hood) like to submit the form for @associations.
- The catch is, this second form submission would require the post_id field from the newly created @post.
What would be the best way to achieve this? Would nested forms help me pull the newly created @post.id? Kindly help me with this.
If this is something that should happen whenever you create a
Post, then you should use active callbacks to achieve that :or, you can write it like that also :
Otherwise, if this is something specific to a controller action, you should simple do something like this :
Hope this helps!