CSN,
You can do something like this:
View:
<%= check_box_tag "checked[#{item.id.to_s}]" %>
Controller:
Item.destroy(params[:checked].keys) unless params[:checked].nil?
You could use Item.delete if you don''t want to instantiate the objects
first.
Cody
On 12/5/05, CSN
<cool_screen_name90001-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
wrote:> Is there a quick and easy way to delete multiple items? I''d like
to have this in my list view:
>
> <% for item in @items %>
> ...code with delete checkbox...
> <% end %>
>
> Then if a delete submit button at the end of the items list is clicked, any
item with its delete
> checkbox would get deleted.
>
> thanks
> csn
>
>
>
> __________________________________
> Start your day with Yahoo! - Make it your home page!
> http://www.yahoo.com/r/hs
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
http://www.codyfauser.com