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.
cool_screen_name90001 (Guest)
on 2005-12-05 22: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!
codyfauser (Guest)
on 2005-12-05 22: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 <removed_email_address@domain.invalid> wrote:
> csn
This topic is locked and can not be replied to.