On Jul 25, 2011, at 1:25 PM, Linus Pettersson wrote:
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
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.