helloxielan 2015-07-23 21:38 采纳率: 0%
浏览 19

Rails Ajax调用返回500

I have got a ajax call which deletes some data from database. The data is deleted properly, but The action returns a failure ...

code looks like this:

def remove_user_from_group
  @usergroup = UserGroup.find params[:usergroup_id]
  @user = User.find params[:user_id]
  @usergroup.users.delete(@user)
  if @usergroup.save
    flash[:notice] = t("flash.deleted")
    render :add_user_to_group
  else
    flash[:notice] = t("flash.login_failed_nouser")
    render :add_user_to_group
  end
end

Whats going wrong? I do exactly the same for adding data and it works fine.

  • 写回答

0条回答 默认 最新

      报告相同问题?

      悬赏问题

      • ¥15 存储过程或函数中的结果集类型变量如何使用。
      • ¥80 关于海信电视聚好看安装应用的问题
      • ¥15 vue引入sdk后的回调问题
      • ¥15 求一个智能家居控制的代码
      • ¥15 ad软件 pcb布线pcb规则约束编辑器where the object matpcb布线pcb规则约束编辑器where the object matchs怎么没有+15v只有no net
      • ¥15 虚拟机vmnet8 nat模式可以ping通主机,主机也能ping通虚拟机,但是vmnet8一直未识别怎么解决,其次诊断结果就是默认网关不可用
      • ¥20 求各位能用我能理解的话回答超级简单的一些问题
      • ¥15 yolov5双目识别输出坐标代码报错
      • ¥15 这个代码有什么语法错误
      • ¥15 给予STM32按键中断与串口通信