Ask A Question


You’re not receiving notifications from this thread.

Using VueJS for Nested Forms in Rails: Part 2 Discussion

Why did not you use "Vue.http.headers.common['X-CSRF-Token'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content')" ?
I believe he goes over that in Part 1 of the series.
This is a great series, Chris. Very helpful. It would be great if you could do a tutorial that uses Vue inside 'form_for' or 'form_with'. Most of the Vue Rails form tutorials out there use a basic HTML form and I'd love to drop Vue into small areas of the form without overhauling everything.

Hey Travis.

I think you can pass the data-remote="true" paramater, like this:

Hi Chris,
For more deeply nested forms, would you recommend using something like JBuilder to properly format the JSON and pass it to Vue?
Thanks for the great vids! I'd love to see more Vue with Rails videos. I'm loving the framework.

This comment since june/2016. Still there is no tutorial about "deep" nested_attributes and vue tutorial for rails. (like: team/player/football_shoes[:size, color, brand]) until 2 months i am trying to found a way for it. :(


So while this is awesome, it's also very inconvenient to go putting all this code in a single vue file... how can we move this functionality into components like shown in the Vue.js components episode?


Is there any tutorial about visual error handling of forms (after post and put)?
Now all fails silently...
Thanks Chris.


Hello all!

While using this technique, a came across a problem.

Im basically building an invoice with various fields calculations and nested items, all works fine.

In my form, one of the values is a select box, this helps with some calculations and changes the output of total depending, using computed properties, I then save all of those variables/values to the database on submit.

The problem is when I try then to edit the same record, its opens but the correct saved select values are not show, which will mess the whole calculation.

Any ideas anyone?



Join the discussion
Create an account Log in

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

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

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