Administrate: Namespace option does not allow plurals

Created on 29 Nov 2017  路  4Comments  路  Source: thoughtbot/administrate

I want the custom namespace "ops" since I have Admin as a model name so the Admin module is not possible for me. When I run rails generate administrate:routes --namespace ops I get Could not load generator "generators/administrate/routes/routes_generator". Error: uninitialized constant Op::ApplicationController (the controller is Ops::ApplicationController). It would be great if the "s" was not stripped from the namespace. Thanks!

bug documentation namespacing

Most helpful comment

You could try to disable the inflector rule with something like this:

# config/initializers/inflections.rb
ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.uncountable %w{ ops }
end

All 4 comments

You could try to disable the inflector rule with something like this:

# config/initializers/inflections.rb
ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.uncountable %w{ ops }
end

I just hit this issue today - would this be a useful note to add to the docs?

Adding to the inflector is the right thing to do here (it's conventional Rails). I'd love to see a mention in the docs though, so someone can easily fix this in the future!

Ran into this today, changing the inflection makes no sense for us as the namespace corresponds to a module Things, not a module Thing. I found the following works as a workaround:

module Admin
  module Things
    class StuffsController < Admin::ApplicationController
      def resource_class
        ::Things::Stuff
      end

      def dashboard_class
        ::Things::StuffDashboard
      end
    end
  end
end
Was this page helpful?
0 / 5 - 0 ratings

Related issues

MatthiasRMS picture MatthiasRMS  路  3Comments

steffenix picture steffenix  路  4Comments

ghost picture ghost  路  4Comments

ACPK picture ACPK  路  4Comments

preist picture preist  路  4Comments