Rails - Model name ends with S

What's the right way to do this?

I use inflections to document uncountable entities.

config/initializers/inflections.rb

ActiveSupport::Inflector.inflections do |inflect|
  inflect.uncountable "ActiveDns"
end

Then you get:

$ rails g scaffold_controller ActiveDns
      create  app/controllers/active_dns_controller.rb
      invoke  erb
      create    app/views/active_dns
      create    app/views/active_dns/index.html.erb
      create    app/views/active_dns/edit.html.erb
      create    app/views/active_dns/show.html.erb
      create    app/views/active_dns/new.html.erb
      create    app/views/active_dns/_form.html.erb
      invoke  test_unit
      create    test/functional/active_dns_controller_test.rb
      invoke  helper
      create    app/helpers/active_dns_helper.rb
      invoke    test_unit
      create      test/unit/helpers/active_dns_helper_test.rb

Is this what you wanted?


I tested with rails-3.2 (I guess it should work with rails-3.x)

Open your config/initializers/inflections.rb and add a rule:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'dns', 'dnses'
end

And generate the controller

rails g scaffold_controller ActiveDns

And add routes to your config/routes.rb file

resources :active_dnses

Then you should see:

$ rake routes

   active_dnses GET    /active_dnses(.:format)          active_dnses#index
                POST   /active_dnses(.:format)          active_dnses#create
 new_active_dns GET    /active_dnses/new(.:format)      active_dnses#new
edit_active_dns GET    /active_dnses/:id/edit(.:format) active_dnses#edit
     active_dns GET    /active_dnses/:id(.:format)      active_dnses#show
                PUT    /active_dnses/:id(.:format)      active_dnses#update
                DELETE /active_dnses/:id(.:format)      active_dnses#destroy