This patch will allow you to initialize any blank associations for your models that are using nested_attributes_for.
# for one-to-one association form_for(@post) do |f| f.text_field(:title)
f.fields_for(:author, :new_if_blank => true) do |af| af.text_field(:name) end end
# for collection associations # this will create 3 blank comments form_for(@post) do |f| f.text_field(:title)
f.fields_for(:comments, :new_if_blank => 3) do |cf| cf.text_field(:name) end end
Thanks. Mike