我想为用户设置CRUD,仅供我的Web应用程序的管理员使用。 所以在routes.rb中:Rails:form_for名称空间资源
namespace :admin do
resources :user
end
这意味着这样的:
admin_user_index GET /admin/user(.:format) admin/user#index
POST /admin/user(.:format) admin/user#create
new_admin_user GET /admin/user/new(.:format) admin/user#new
edit_admin_user GET /admin/user/:id/edit(.:format) admin/user#edit
admin_user GET /admin/user/:id(.:format) admin/user#show
PUT /admin/user/:id(.:format) admin/user#update
DELETE /admin/user/:id(.:format) admin/user#destroy
显示,指数做工精细,但编辑和新的没有。我一直在_form第一行收到此错误:
未定义的方法`user_path”为#<#:0x007fb6645c6378>
这是这样的:
如何使用的form_for与命名空间资源?
真棒!谢谢=)=) – Barbared
哦,男人,我一直追着我的尾巴大约一个小时,直到我找到了答案。 – janosrusiczki