【发布时间】:2015-06-11 08:22:29
【问题描述】:
我在 Rails 中使用 link_to 需要单个路由助手,我通过在我的 routes.rb 文件中写入获得:
resources :contact_informations 生成 new_contact_information 作为路由助手等等。
但是,当我在以下资源下添加collection 时:
collection do
get :a_new_route
end
新生成的路由变成这样的复数:
a_new_route_contact_informations
如何在collection 中添加更多路由而不使其变为复数?
谢谢!
【问题讨论】:
-
你想要
resources :contact_informations,而不是resource :contact_informations.. 你确定吗?对于resources,它将始终是复数。 -
好吧,我所知道的是,如果我写
resources :contact_informations它会给我new_contact_informationinrake routes
标签: ruby-on-rails routing routes