问题
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