Моя проблема была решена: html:
<td><%= link_to 'Destroy', article_path(article),remote: true,
method: :delete,remote: true,class: "destroy-product",
data: { confirm: 'Are you sure?' } %></td>
код ArticlesController
:
> @article = Article.find(params[:id])
> respond_to do |format|
> if @article.destroy
> format.js { flash.now[:notice] = "OK" }
> else
> format.js { flash.now[:notice] = "Fail" }
> end
> end
destroy.js.erb:
alert("<%= j flash[:notice] %>");
$('.destroy-product').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});