Rails 3路由范围,排除一个动作?

时间:2014-01-21 22:19:58

标签: ruby-on-rails

我的路线设置为

scope "/admin" do
    resources :profiles
end

所以我用/ admin / profiles获得了预期的路由。我想从显示操作中排除这个前缀。是否有捷径可寻?我在文档中看到的每个解决方案都是围绕嵌套资源的,我确信我忽略了一些东西。谢谢!

1 个答案:

答案 0 :(得分:5)

我认为

scope "/admin", do
  resources :profiles, except: :show
end

是你需要的。

http://guides.rubyonrails.org/routing.html#restricting-the-routes-created

了解详情