【发布时间】:2010-11-21 23:12:01
【问题描述】:
我有 2 个继承资源(带有 Jose Valim 插件)- 博客和帖子。当然 - 博客 hm 帖子和发布 bt 博客。路由就够了
resources :blogs, :only => [:show] do
resources :posts
end
我还更新了动作帖子#index
def index
redirect_to parent_url
end
按照我的计划 - 在尝试访问 http://devhost/blogs/2/posts 时,我将被重定向到 http://devhost/blogs/2,但我看到路由错误
No route matches {:action=>"show", :controller=>"blogs"}
很奇怪,因为我看到了
blog GET /blogs/:id(.:format) {:controller=>"blogs", :action=>"show"}
在 rake 路线上。
任何想法 - 可能导致以下错误的原因是什么?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 inherited-resources