设计的嵌套资源
问题描述:
这是我的路线文件。设计的嵌套资源
devise_for :users, :path => 'accounts'
resources :users do
resources :articles
end
如何显示主页上用户的所有文章 ?
答
试试这个(HAML):
- current_user.articles.each do |article|
= article.name
你必须确保你已经建立在你的articles_controller
用户和正确的文章之间的关联。