hi, i’m trying to work this out and been using a bit of the ‘blog in 15
minutes’ code to basically add a new item to a list from within the
‘show’ action of the list.
much like how when in the example blog app you view a post and can add
comments to it on the ‘show’ page.
here’s the item model
class Item < ActiveRecord::Base
acts_as_list :scope => :list
and the list model
class List < ActiveRecord::Base
has_many :items, :order => “position”
and within the show list page i’ve got a ‘add item’ form
<% form_tag :action => “item”, :id => @list do %>
<%= text_field “item”, “body”, ‘size’ => 15 %>
<%= submit_tag “Add” %>
<% end %>
that fires this action
@item = List.find(params[:id]).items.create(params[:body])
flash[:notice] = “added your item.”
redirect_to :action => “show”, :id => params[:id]
it all works pretty well alas no item gets created, any ideas?
pulling my hair out on this one…