Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 铁路路线:浅层=>;真的_Ruby On Rails_Ruby_Routes - Fatal编程技术网

Ruby on rails 铁路路线:浅层=>;真的

Ruby on rails 铁路路线:浅层=>;真的,ruby-on-rails,ruby,routes,Ruby On Rails,Ruby,Routes,想知道为什么我申请时我的文章路线没有出现:shallow=>true routes.rb resources :users, :shallow => true do resources :articles end 我也试过: resources :users do resources :articles, :shallow => true end 访问/articles不会像预期的那样显示任何用户的所有文章,但我仍然可以访问/articles/:id。这是预期的行为吗?浅

想知道为什么我申请时我的文章路线没有出现:shallow=>true

routes.rb

resources :users, :shallow => true do
  resources :articles
end
我也试过:

resources :users do
  resources :articles, :shallow => true
end

访问/articles不会像预期的那样显示任何用户的所有文章,但我仍然可以访问/articles/:id。这是预期的行为吗?

浅层:true选项没有根据提供索引资源。因此,您将无法仅访问
/文章
。是的,这是预期的行为