Search code examples
ruby-on-railsadminrails-admin

Rails Admin Model with all upcase module name


I have a model that is within an all upcase module :

# app/models/abc/site.rb
module ABC
  class Site < ActiveRecord::Base
  end
end

And in config :

# config/initializers/rails_admin.rb
config.included_models = [
  'ABC::Site',
]

config.model ABC::Site do
  edit do
    ...
  end
end

But rails admin has links to the view that are lower case /admin/abc~site, and result in Model 'Abc::Site' could not be found being shown on the main index when clicked on.

We found that /admin/ABC~site does work, but any action on that page causes it to reload the lower case version.

I assume I have configured it incorrectly, does anyone know what I need to set?

  • Rails 4.2.4
  • rails_admin (0.8.1)

Solution

  • Have you tried declaring it as an acronym in an initializer?

    ActiveSupport::Inflector.inflections(:en) do |inflect|
        inflect.acronym 'ABC'
    end