rails_admin plural field names

寵の児 提交于 2019-12-12 04:39:49

问题


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

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

undefined method `*_statu_id'

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?


回答1:


"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'


来源:https://stackoverflow.com/questions/7427987/rails-admin-plural-field-names

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!