Why does rails scaffold generator is simply ignoring my config/iniatilizers/inflections.rb?

338 views Asked by At

I'm using Rails 3.2 with ruby 2.1

I put this code into my config/initializers/inflections.rb :

  ActiveSupport::Inflector.inflections do |inflect|
    inflect.irregular 'pub_type_contributeur', 'pub_types_contributeurs'
    inflect.irregular 'PubTypeContributeur', 'PubTypesContributeurs'
  end

When I test it with my rails console it works :

rails console
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loading development environment (Rails 3.2.16)
2.1.0 :001 > "attendance".pluralize
 => "attendances" 
2.1.0 :002 > "pub_type_contributeur".pluralize
 => "pub_types_contributeurs" 
2.1.0 :003 > exit

But when I use the standard generator, it just ignore my inflection :

rails generate scaffold pub_type_contribueur nom:text -p
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
      invoke  active_record
      create    db/migrate/20141112191424_create_pub_type_contribueurs.rb
      create    app/models/pub_type_contribueur.rb
      invoke    rspec
      create      spec/models/pub_type_contribueur_spec.rb
      invoke      factory_girl
      create        spec/factories/pub_type_contribueurs.rb
      invoke  resource_route
       route    resources :pub_type_contribueurs
      invoke  scaffold_controller
      create    app/controllers/pub_type_contribueurs_controller.rb
      invoke    haml
      create      app/views/pub_type_contribueurs
      create      app/views/pub_type_contribueurs/index.html.haml
      create      app/views/pub_type_contribueurs/edit.html.haml
      create      app/views/pub_type_contribueurs/show.html.haml
      create      app/views/pub_type_contribueurs/new.html.haml
      create      app/views/pub_type_contribueurs/_form.html.haml
      invoke    rspec
      create      spec/controllers/pub_type_contribueurs_controller_spec.rb
      create      spec/views/pub_type_contribueurs/edit.html.haml_spec.rb
      create      spec/views/pub_type_contribueurs/index.html.haml_spec.rb
      create      spec/views/pub_type_contribueurs/new.html.haml_spec.rb
      create      spec/views/pub_type_contribueurs/show.html.haml_spec.rb
      create      spec/routing/pub_type_contribueurs_routing_spec.rb
      invoke    helper
      create      app/helpers/pub_type_contribueurs_helper.rb
      invoke      rspec
      create        spec/helpers/pub_type_contribueurs_helper_spec.rb
      invoke  assets
      invoke    coffee
      invoke    scss
      invoke  scss

What am I doing wrong ?

1

There are 1 answers

0
Douglas On BEST ANSWER

Ok some time we work too late and misspell name... sorry this is my bad, I forgot the "t" letter.

my command was incorrect :

rails generate scaffold pub_type_contribueur nom:text --no-stylesheets -p

This is the correct one :

rails generate scaffold pub_type_contributeur nom:text --no-stylesheets -p