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)