rails_admin多场名 [英] rails_admin plural field names

查看:308
本文介绍了rails_admin多场名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 rails_admin 在一个应用程序,我得到一个意外的错误。

I'm using rails_admin in an app and I'm getting an unexpected error.

在一个特定的模式,我有一个名为* _status_id领域。
当试图编辑模式rails_admin,我得到这个错误:

In a certain model, I have a field called *_status_id.
When trying to edit that model in rails_admin, I get this error:

未定义的方法`* _statu_id

undefined method `*_statu_id'

显然,rails_admin认为我的资源为多个,当它不是。 有没有让Rails的/ rails_admin知道如何正确地使用这些资源的一种方式?

Obviously, rails_admin thinks my resource is plural, when it is not. Is there a way of letting Rails/rails_admin know how to use this resource properly?

推荐答案

身份有一个不规则的复数;其中一个导轨不知道自动。在配置/初始化/ infelctions.rb ,保证了的ActiveSupport :: Inflector.inflections 块取消注释,并添加下面给它:

"status" has an irregular plural; one which Rails doesn't know about automatically. In config/initializers/infelctions.rb, ensure the ActiveSupport::Inflector.inflections block is uncommented, and add the following to it:

inflect.uncountable 'status'

这篇关于rails_admin多场名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆