Render a "new" form in another view

Hi!

I have a list where you can add items, where Items are nested inside Lists.

So, now I want to render my form partial to create new items in the Lists show view. I want to be able to add items to the list without leaving the list through a link.

My _form partial looks like this

<%= semantic_form_for [@item.list, @item] do |f| %> <%= f.inputs “Item” do %> <%= f.input :title %> <%= f.input :amount %> <%= f.input :unit %> <% end %> <%= f.buttons %> <% end %>

I have tried to just do <%= render ‘items/form’ %> which doesn’t work. I guess I have to send populate the @item variable when rendering the template.

Also, I’m not sure how the form will know this is a new action and not an edit.

It will know because the @item won't have an ID -- @item.new_record? will return true.

Walter