Forum: Ruby on Rails Deleting many items

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-12-05 21:02
(Received via mailing list)
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.


Start your day with Yahoo! - Make it your home page!
2ccb2f7699267d258faaafce4ee997df?d=identicon&s=25 codyfauser (Guest)
on 2005-12-05 21:30
(Received via mailing list)

You can do something like this:

<%= check_box_tag "checked[#{}]" %>

Item.destroy(params[:checked].keys) unless params[:checked].nil?

You could use Item.delete if you don't want to instantiate the objects


On 12/5/05, CSN <> wrote:
> csn
This topic is locked and can not be replied to.