I have build a contacts page which displays a number of contacts. I have 
attached a check_box_tag with each row of these. And then a button to 
delete those selected. But it is not working. Following is the code snipet,

_contact.html.erb

> <% @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%> 
>

In Contacts_controller

def destroySelected
>     Contact.delete_all(:id => params[:contact_ids])
>     respond_to do |format|
>         format.html {redirect_to contacts_url}
>         format.js
>     end
>   end
>

but my development log says no value has been recieved in "id".

Where am I doing wrong? Can anyone help.
 

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/eI8HiQZc0fcJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to