Ruby on Rails Monday, June 10, 2019

Let's say you have a user that has many books, if you want to hace some book prefilled just do

@user.books.build(title: something, year: someyear)

As long as you don't reload the relationship, the books will be on the user (just not persisted) and `fields_for :books` will iterate over them

You can give a try to my gem for dynamic nested fields, I'd really appreciate it :D https://rubygems.org/gems/vanilla_nested (it's similar to cocoon but weight less than 10%, and it has no dependencies like cocoon that adds a lot of gems and depends on jquery)

El lun., 10 jun. 2019 a las 16:40, tom (<tomabroad@gmail.com>) escribió:
HI, i am baffled on how to make the first set of nested fields visible. 
currently, it all works, but even just in order to display the 1st set of fields, i have to click "add .... "


2)
how do i assign values to the object in the controller to the first set ?


thank you

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMe6zJLnfg_PqM9G7qijxJbiEGcetoG2uifp8tvg2rJa2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcAXnPUWJ8iBxONW1Yibyyb6cLc%3D0cofMBKL_83qjYN%2BDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment