I tried to delete from a datatable that I represent with will_paginate
and ajax. In the view there are something like that:
<tbody>
<% @items.each do |i| %>
<tr class="<%= cycle("even","odd")
%>">
<td><%= i.name %></td>
<td><%= i.quantity %></td>
<td><%= i.price %></td>
<td><%= link_to ''Destroy'', :method =>
:delete %></td>
</tr>
<% end %>
</tbody>
In the controller I have this:
def destroy(a)
@Item = Item.find(:id)
@Item.destroy
end
And the web don''t have error but don''t run I have to do with
ajax or
something like that??
Thank you very much!!
--
Posted via http://www.ruby-forum.com/.
<%= link_to ''Destroy'',:confirm => ''Are you
sure?'',:action =>
''destroycat'',:id => p.id, :method => :delete %>
and controller like this
def destroycat
@pro_categorie = ProCategorie.find(params[:id])
@pro_categorie.destroy
respond_to do |format|
format.html { redirect_to(admins_url) }
format.xml { head :ok }
end
end
--
Posted via http://www.ruby-forum.com/.