如果我像下面那样设置路由,它会自动创建路径,例如 的 community_community_topic 下, 的 new_community_community_topic 下, 的 edit_community_community_topic
resources :communities, :path => "community" do
resources :community_topics, :path => "topic"
end
如果我想要这样的路径怎么办? community_topic 而不是 community_community_topics
我如何编码我的routes.rb ??
答案 0 :(得分:1)
您是否尝试使用:as
?见Railsguides on routing:
resources :magazines do
resources :ads, :as => 'periodical_ads'
end