Ask A Question

Notifications

You’re not receiving notifications from this thread.

Dynamic Nested Forms With Turbo Part 2 Discussion

Great lesson: thanks Collin! I learned a couple of new tricks there - appreciated!

Reply

Hey Terry! Thanks so much for the kind words and I’m super glad to hear that you enjoyed it and got some new tricks out of it!

Reply

For some reason, I lost the ability to update after adding the helper at the end. Anyone else?

Unpermitted parameters: :task_12, :task_13. Context: { controller: ProjectsController, action: update, request: #<ActionDispatch::Request:0x000000010f9478b0>, params: {"_method"=>"patch", "authenticity_token"=>"[FILTERED]", "project"=>{"name"=>"something", "tasks_attributes"=>{"task_12"=>{"description"=>"text"}, "task_13"=>{"description"=>"text",}}}, "button"=>"", "controller"=>"projects", "action"=>"update", "id"=>"2"} }
Reply

Hmmm, I not sure but let me look into that for you and report back!

Reply

Well, looked into it further. Def a bug. Rails doesn't like when you try to send that stuff through with the keys for the tasks as dom_id's which is a bummer. I got a fix you can see here https://github.com/gorails-screencasts/dynamic-nested-forms-with-turbo-get/commit/adfe726005c89f1c71b81f1ddf63c797bddad80a
I'm gonna look into this more when a have some free time to see what else can be done here bc I feel like there's a better option. Sorry about that but thanks for bringing it up, Willard!

Reply

Thanks for the videos! One thought on the beginning part where you change the form to use task.hash. Why not just use that for all the tasks? If you include the ID as a hidden field, which I think you do in your code, I think Rails looks for the ID in the params hash anyways when updating existing records, right?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,584+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.