<% @contacts.each do |contact| %>
<tr class='contactrow' id='contact-<%=contact.id%>'>
<td ><%= check_box_tag "contact_ids[]", contact.id %> </td>
<td><%= contact.name %></td>
<td><%= contact.phone %></td>
<td><%= contact.mailid %></td>
<td><%= contact.age %></td>
<td><%= link_to 'Show',
contact,
:remote=>true
%></td>
<td><%= link_to 'Edit',
edit_contact_path(contact),
:remote => true%></td>
<td><%= link_to 'Destroy',
contact,
:method => :delete,
:data => { :confirm => 'Are you sure?' },
:remote => true %></td>
<td><%= link_to 'Send Mail',
{:action => "createmail", :id => contact.id},
:remote => true %></td>
</tr>
<% end %>
<%= link_to 'Destroy Selected',
{:action => 'destroySelected',
:id => 'contact_ids'},
:remote => true%>
def destroySelected
Contact.delete_all(:id => params[:contact_ids])
respond_to do |format|
format.html {redirect_to contacts_url}
format.js
end
end
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/DWnPNOCF_jEJ.--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
Parameters: {"contact_ids"=>"contact_ids[]"}
Started GET "/destroy_selected?contact_ids=contact_ids%5B%5D" for 127.0.0.1 at Mon Jul 23 14:56:04 +0530 2012
Processing by ContactsController#destroySelected as JS
Parameters: {"contact_ids"=>"contact_ids[]"}
SQL (0.1ms) DELETE FROM "contacts" WHERE "contacts"."id" IS NULL
Redirected to http://localhost:3000/contacts
Completed 302 Found in 1ms (ActiveRecord: 0.1ms)
<%= link_to 'Destroy Selected',
{:action => 'destroySelected',
:contact_ids => 'contact_ids[]'},
:remote => true%>
def destroySelected
Contact.delete_all(:id => params[:id])
respond_to do |format|
format.html {redirect_to contacts_url}
#format.js
end
end