Ruby on Rails:用户未从 postgres 数据库中删除

问题描述

我正在开发一个使用 ActiveAdmin 的 ROR 应用程序。我正在尝试使用批处理操作删除用户。它显示成功的消息,但实际上并没有从数据库(postgres)中删除用户。

这里是批量操作的代码-

batch_action :destroy,:confirm => "Are you sure you want to delete the user?",do |ids|
   Application::RecordsDestroy.perform_async Application::User,ids
   redirect_to user_path,:notice => "User is deleted"
   end

这是Records Destroy文件的代码-

  class RecordsDestroy
    include Sidekiq::App

    def perform(res_model,ids)
      records = res_model.constantize.where(id: ids).destroy_all
      Rails.logger.info "Records for model #{res_model} have been premanently deleted"
    end
  end

谁能告诉我代码有什么问题?为什么它不起作用?

任何形式的帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)