我有两个继承的资源(加上Jose的插件)-博客和帖子。当然-博客,博客,博客和博客。路线就足够了
resources :blogs, :only => [:show] do
resources :posts
end此外,我还用以下内容更新了操作posts#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路线上。
任何想法-什么会导致后续的错误?
发布于 2010-11-22 00:00:59
似乎父母(博客)没有设置,因为它没有出现在路线旁。你把belongs_to添加到PostsController了吗?
PostsController < InheritedResources::Base
belongs_to :blog
...https://stackoverflow.com/questions/4240975
复制相似问题