0

在我的 Ruby on Rails Web 应用程序中,我有以下文件:

app/models/big.rb
app/controllers/big_controller.rb
app/models/small.rb
app/controllers/small_controller.rb

http://localhost:8080/big/1和之类的链接效果http://localhost:8080/small/很好,但我希望能够拥有一个链接,例如

http://localhost:8080/big/1/small 

我如何设置路线来做到这一点?我希望不必经过并更新所有路径(例如small_path

4

1 回答 1

1

你可以做这样的事情(嵌套路由/资源)

resources :big do
  resources :small
end

http://guides.rubyonrails.org/routing.html#nested-resources

于 2013-06-02T16:22:47.700 回答