奇怪的铁路2路由问题
我在 Rails 2 vs 3 比较 pdf 讲座中看到了这一点,我不确定预览和存档标志发生了什么。
post.resources :comments, :member => { :preview => :post },
:collection => { :archived => :get }
有什么想法吗?
I saw this in a rails 2 vs 3 comparison pdf lecture and I'm not sure what's going on with the preview and archived flags.
post.resources :comments, :member => { :preview => :post },
:collection => { :archived => :get }
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
<代码>:成员=> {:预览=> :post}
正在成员上建立另一种方法,该方法将像这样访问:
comments/1/preview
并且只能通过 post 访问。
类似地,
:collection => {:已存档=> :get}
为整个集合建立一个方法,可以通过comments/archived
访问该方法:member => { :preview => :post}
Is establishing another method on the member that would would be accessed like so:
comments/1/preview
and would only be accessible through post.
Similarly,
:collection => {:archived => :get}
establishes a method for the whole collection, that would be accessed throughcomments/archived