我如何复制狂欢删除行为?

时间:2021-09-15 09:18:28

I wish to replicate the delete behavior, i manage to delete the data from the database with

我希望复制删除行为,我设法从数据库中删除数据

    def destroy
        @my_object = Spree::MyObject.find(params[:id])
        @my_object.destroy

        flash[:success] = Spree.t('notice_messages.object_deleted')

        respond_with(@my_object) do |format|
            format.html { redirect_to collection_url }
            format.js { render :partial => 'destroy' }
        end
    end

and a helper

和帮助者

<%= link_to_delete my_object, :url => "#{main_app.admin_objectarea_obejects_url}/#{ad_zone.id}", :no_text => true %>

but it doesn't fire the jquery behavior, the funny thing is if a change the url, for something like "http://0.0.0.0:3000/admin/products/apache-baseball-jersey", the behavior work and the row is removed

但是它没有触发jquery行为,有趣的是如果更改了url,对于像“http://0.0.0.0:3000/admin/products/apache-baseball-jersey”这样的行为工作和行被删除

1 个解决方案

#1


0  

I find out that the logic was right, it was returning a falior because of a missing translation, that jquery somehow translate in error

我发现逻辑是正确的,它因为缺少翻译而返回了一个falior,jquery以某种方式转换为错误

#1


0  

I find out that the logic was right, it was returning a falior because of a missing translation, that jquery somehow translate in error

我发现逻辑是正确的,它因为缺少翻译而返回了一个falior,jquery以某种方式转换为错误