2017-06-01 17 views
1

我在Rails的新的,現在我想創建一個自定義多元化所以我把這個在我初始化/是inflections.rbRails的5個自定義語調不工作

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

但當我嘗試軌控制檯上,我得到:

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 > 

我也試圖把這個在我的是inflections.rb但具有相同的結果:

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

由於我使用Rails的國際化我application.rb中有這樣額外的行:

config.i18n.default_locale = 'pt-BR' 

我搜索了很多,並沒有找到一個解決方案。

有什麼建議嗎?

回答

2

嘗試DISABLE_SPRING=1

+0

運行控制檯沒有Spring謝謝亞當。它確實有用! –