1

activeadmin无出错提示

 3 years ago
source link: http://blog.ilibrary.me/2020/01/14/activeadmin%E6%97%A0%E5%87%BA%E9%94%99%E6%8F%90%E7%A4%BA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
activeadmin无出错提示 | 垂钓江湖
欢迎转载,请支持原创,保留原文链接:blog.ilibrary.me

Active Admin创建对象失败的情况下没有出错提示, 页面继续留在新建对象页面. 原因是自定义了form表单,把validation提示弄丢了。

解决办法是加object_form.semantic_errors :base

具体参考下面的代码,把带注释的那一行加上就可以了。

form do |f|
  object_form.semantic_errors :base #  这一行用来显示出错提示
  f.has_many :object do |object_form|
    
    object_form.input :color
  end

end
  1. Form DSL support for formtastic’s semantic_errors method
扫描二维码分享到微信朋友圈Loading...Please waitqrcode.php?url=%2F2020%2F01%2F14%2Factiveadmin%25E6%2597%25A0%25E5%2587%25BA%25E9%2594%2599%25E6%258F%2590%25E7%25A4%25BA

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK