Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:46:24+00:00 2026-06-15T08:46:24+00:00

I generated a scaffold with following command : rails generate scaffold indice valeur:decimal date:date

  • 0

I generated a scaffold with following command :

rails generate scaffold indice valeur:decimal date:date

I use the gorgeous gem “rails-translate-routes” to translate URLs(path) to french with I18 internationalization.

I as well put the indices controller into a namespace (app/controller/catalogs/pub_indices_controller.rb) with my config/route.rb :

  namespace :catalogs do
    resources :pub_indices
  end

The resulting routes are incorrect because of Rails inflection. It use “index” instead of “indice” for singular, though I use “indice” to generate and my model is called pub_indice.rb :

             catalogs_pub_indices_fr GET    /catalogues/indices(.:format)                      catalogs/pub_indices#index {:locale=>"fr"}
             catalogs_pub_indices_en GET    /en/catalogs/pub_indices(.:format)                 catalogs/pub_indices#index {:locale=>"en"}
                                     POST   /catalogues/indices(.:format)                      catalogs/pub_indices#create {:locale=>"fr"}
                                     POST   /en/catalogs/pub_indices(.:format)                 catalogs/pub_indices#create {:locale=>"en"}
           new_catalogs_pub_index_fr GET    /catalogues/indices/nouveau(.:format)              catalogs/pub_indices#new {:locale=>"fr"}
           new_catalogs_pub_index_en GET    /en/catalogs/pub_indices/new(.:format)             catalogs/pub_indices#new {:locale=>"en"}
          edit_catalogs_pub_index_fr GET    /catalogues/indices/:id/modifier(.:format)         catalogs/pub_indices#edit {:locale=>"fr"}
          edit_catalogs_pub_index_en GET    /en/catalogs/pub_indices/:id/edit(.:format)        catalogs/pub_indices#edit {:locale=>"en"}
               catalogs_pub_index_fr GET    /catalogues/indices/:id(.:format)                  catalogs/pub_indices#show {:locale=>"fr"}
               catalogs_pub_index_en GET    /en/catalogs/pub_indices/:id(.:format)             catalogs/pub_indices#show {:locale=>"en"}
                                     PUT    /catalogues/indices/:id(.:format)                  catalogs/pub_indices#update {:locale=>"fr"}
                                     PUT    /en/catalogs/pub_indices/:id(.:format)             catalogs/pub_indices#update {:locale=>"en"}
                                     DELETE /catalogues/indices/:id(.:format)                  catalogs/pub_indices#destroy {:locale=>"fr"}
                                     DELETE /en/catalogs/pub_indices/:id(.:format)             catalogs/pub_indices#destroy {:locale=>"en"}

So I googled a bit and discover the word “inflector”…
So I used the trick provided by official doc in my config/route.rb :

  ActiveSupport::Inflector.inflections do |inflect|
    inflect.irregular 'indice', 'indices'
  end

And the route helpers look alright :

             catalogs_pub_indices_fr GET    /catalogues/indices(.:format)                      catalogs/pub_indices#index {:locale=>"fr"}
             catalogs_pub_indices_en GET    /en/catalogs/pub_indices(.:format)                 catalogs/pub_indices#index {:locale=>"en"}
                                     POST   /catalogues/indices(.:format)                      catalogs/pub_indices#create {:locale=>"fr"}
                                     POST   /en/catalogs/pub_indices(.:format)                 catalogs/pub_indices#create {:locale=>"en"}
          new_catalogs_pub_indice_fr GET    /catalogues/indices/nouveau(.:format)              catalogs/pub_indices#new {:locale=>"fr"}
          new_catalogs_pub_indice_en GET    /en/catalogs/pub_indices/new(.:format)             catalogs/pub_indices#new {:locale=>"en"}
         edit_catalogs_pub_indice_fr GET    /catalogues/indices/:id/modifier(.:format)         catalogs/pub_indices#edit {:locale=>"fr"}
         edit_catalogs_pub_indice_en GET    /en/catalogs/pub_indices/:id/edit(.:format)        catalogs/pub_indices#edit {:locale=>"en"}
              catalogs_pub_indice_fr GET    /catalogues/indices/:id(.:format)                  catalogs/pub_indices#show {:locale=>"fr"}
              catalogs_pub_indice_en GET    /en/catalogs/pub_indices/:id(.:format)             catalogs/pub_indices#show {:locale=>"en"}
                                     PUT    /catalogues/indices/:id(.:format)                  catalogs/pub_indices#update {:locale=>"fr"}
                                     PUT    /en/catalogs/pub_indices/:id(.:format)             catalogs/pub_indices#update {:locale=>"en"}
                                     DELETE /catalogues/indices/:id(.:format)                  catalogs/pub_indices#destroy {:locale=>"fr"}
                                     DELETE /en/catalogs/pub_indices/:id(.:format)             catalogs/pub_indices#destroy {:locale=>"en"}

But Rails refuse to accept routes using “indice” like this : new_catalogs_pub_indice_path

Instead it accept the incorrect form : new_catalogs_pub_index_path though rake route is saying something different.

Could anyone explain me what am I doing wrong ? (I wish Rails didn’t used this singular/plural form. It would have been so much simpler sigh)

===== UPDATE =====

Ok, I was to quick on this question. After some more search, Il realized my “inflector” code should rather be placed into config/initializers/inflections.rb :

  ActiveSupport::Inflector.inflections do |inflect|
    inflect.irregular 'indice', 'indices'
  end

The official doc just explain how. It doesn’t tell where. So as the context was talking about config/route.rb I thought about puting my code into route.rb but that is wrong.

Official doc is lacking explanation about inflector. That’s a shame ^^
Be carefull guys 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:46:24+00:00Added an answer on June 15, 2026 at 8:46 am

    Ok, as I explained in my update.

    route helpers syntax may be changed by using infelctor in config/initializers/inflections.rb.

    The official doc shows an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The command rails generate scaffold Post name:string title:string content:text generated the following 20101109001203_create_posts.rb file:
This CURD generated by scaffold method using following command rails g scaffold contact fullname:string
I'm new to rails and was trying out the scaffold command - the following
I'm following this tutorial (seems good) for Rails. After I run ruby script/generate scaffold
I ran the following commands: rails generate scaffold order name:string address:text email:string pay_type:string rails
I use scaffold to create my first MVC in Rails 3.1 rails generate scaffold
In Rails, when you create a model using scaffold like the following: rails generate
ASP.NET MVC 3 can generate scaffold code for us(controllers and views). The generated views
Hi I want to delete all stuff related to rails generate scaffold at once.
If I generate new model, view and controller with rails scaffold generator I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.