我试图使用应用程序助手呈现动态导航菜单,但得到的只是一个哈希
当我加载页面时,这就是它显示的全部内容
[#<Project id: 15, title: "downer", created_at: "2012-07-03 08:36:16", updated_at: "2012-07-03 08:36:16", company_id: 2>]
这是应用程序助手中使用的代码
def project_list(user)
company ||= user.profile.company
projects ||= company.projects
projects.each do |project|
link_to project.title, company_project_path(company, project)
project.scopes.each do |scope|
link_to scope.name, company_project_scope_path(scope.company, scope.project, scope)
end
end
end
和
_nav.erb.html
<%= project_list(current_user) %>