如何在 Rails 3 中设置命名路线?
这件事我已经拖延了一个月了,我一辈子也无法弄清楚这个混蛋。
我正在跟踪访问 website/admin/organizations/org_deals
中的文件
如下所示:
map.namespace :admin do |admin|
admin.namespace :organizations do |organization|
organization.org_deals 'org_deals', :action => 'org_deals'
end
end
我的路线 grep org_deals :
admin_organizations_org_deals /admin/organizations/org_deals {:controller=>"admin/organizations/", :action=>"org_deals"}
我的链接看起来像这样,
admin_organizations_org_deals_path
我将鼠标悬停在我得到的链接上 http://localhost:3000/admin/organizations/org_deals
我点击它,然后我得到:
No such file or directory - /Users/daniellevine/Sites/hq_channel/app/views/admin/organizations/show.html.haml
WTF? :D
This is a month long thing I've been putting off, and I can't for the life of me figure this bugger out.
I'm tracking to access a file in website/admin/organizations/org_deals
My routes look like this :
map.namespace :admin do |admin|
admin.namespace :organizations do |organization|
organization.org_deals 'org_deals', :action => 'org_deals'
end
end
rake routes | grep org_deals :
admin_organizations_org_deals /admin/organizations/org_deals {:controller=>"admin/organizations/", :action=>"org_deals"}
I made my link look like this
admin_organizations_org_deals_path
I mouse over the link I get http://localhost:3000/admin/organizations/org_deals
I click on it, and I get :
No such file or directory - /Users/daniellevine/Sites/hq_channel/app/views/admin/organizations/show.html.haml
WTF? :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几天前,当我升级到 Rails 3 时,我在路由方面遇到了一些麻烦,我无法告诉你有关命名空间的信息,因为我还没有使用它,但是本指南对我非常有帮助,有一个关于命名空间的主题,希望它有帮助:http://edgeguides.rubyonrails.org/routing.html
I had some trouble with routes just a few days ago when i upgraded to rails 3, i can't tell you bout namespaces cuz i didn't used it yet, but this guide was very helpful to me, there's a topic on namespaces, hope it helps: http://edgeguides.rubyonrails.org/routing.html