自定义路由的多态路径?

时间:2014-01-13 15:51:26

标签: ruby-on-rails routing ruby-on-rails-4

<%= collection.each do |record| %>
    <%= link_to record.name, polymorphic_path([:admin, record]) %>
<% end %>

打破这条路线:

resources :users, as: "authors", path: "authors", except: [:create, :destroy]

错误:

undefined method `admin_user_path'

有人可以帮忙吗?

我把它作为Rails错误

1 个答案:

答案 0 :(得分:1)

您还应该在admin namespace

中定义用户资源
namespace :admin do
  resources :users
end