我在rails 2 vs 3比较pdf讲座中看到了这一点,我不确定预览和存档标志会发生什么。
post.resources :comments, :member => { :preview => :post },
:collection => { :archived => :get }
有什么想法吗?
答案 0 :(得分:6)
:member => { :preview => :post}
在成员上建立另一种方法,就像这样访问:
comments/1/preview
并且只能通过邮寄方式访问。
同样,:collection => {:archived => :get}
为整个集合建立了一个方法,可以通过
comments/archived