Skip to content

How To: Set object to blueprint

Baltazore edited this page Sep 27, 2012 · 1 revision

If you want to render another fields_for block into the nested_form you need to build this first. So model_object option could provide this:

<%= fields_for :objective do |fo| %>
  <%= fo.text_field :title %>
  <%= fo.fields_for :tasks, :model_object => Task.default do |ft| %>
    ....
  <% end %>
<% end %>

Or you could use it in #link_to_add

<%= f.link_to_add :tasks, :model_object => Task.default %>

Or

<%= f.link_to_add :tasks, :model_object => TaskBuilder.default_for(current_user) %>