简体   繁体   English

如何更改rails中bang版本更新中的重定向页面?

[英]How do I change redirect page in bang version update in rails?

I don't know the syntax of it. 我不知道它的语法。

update! do {
     success: admin_user_path
   }

Is this the right syntax? 这是正确的语法吗? Im using Active Admin 我正在使用Active Admin

You can find the details on handing success/failures on the Inherited Resources readme . 您可以在Inherited Resources自述文件中找到有关处理成功/失败的详细信息。 ActiveAdmin uses Inherited Resources for all of its controller actions. ActiveAdmin对其所有控制器操作使用Inherited Resources。

class ProjectsController < InheritedResources::Base
  def update
    update! do |success, failure|
      success.html { redirect_to project_url(@project) }
      failure.html { redirect_to root_url }
    end
  end
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM