Ask A Question

Notifications

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')" ?
Reply
I believe he goes over that in Part 1 of the series.
Reply
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.
Reply

Hey Travis.

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

https://stackoverflow.com/questions/10255198/is-there-a-way-to-submit-ajax-json-requests-with-simple-form-for-rails

Reply
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.
Reply

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. :(

Reply

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?

Reply

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

Reply

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?

Thanks

Dan

Reply
Join the discussion
Create an account Log in

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

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

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