开发者

Rails 3 routing: singular option

You used to be a开发者_JAVA百科ble to do:

resources :paises, :singular => :pais

But I tried this in Rails and it didn't work. I want to have 'pais_path()' for show and 'paises_path()' for index.

thanks


open your config/initializers/inflections.rb file and add this

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'pais', 'paises'
end

then your route resources :paises will work for you as expected

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜