Rails 5 custom inflections not working

Viewed 658

I'm new in Rails and now I'm trying to make a custom pluralization so I put this in my initializers/inflections.rb:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.clear        
  # Irregulares
  inflect.irregular "país", "países"    
end

But when I try on rails console I get:

Running via Spring preloader in process 3137
Loading development environment (Rails 5.0.2)
2.3.3 :001 > "país".pluralize
 => "país"
2.3.3 :002 >

I also tried to put this in my inflections.rb but with the same result:

ActiveSupport::Inflector.inflections ("pt-BR") do |inflect|
  inflect.clear
  # Irregulares
  inflect.irregular "país", "países"
end

As I'm using rails-i18n my application.rb has this extra line:

config.i18n.default_locale = 'pt-BR'

I searched a lot and didn't find a solution.

Any suggestions?

1 Answers
Related