Rails: form_for namespaced resource

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 11:31:37

You can add the namespace's name as a symbol:

 <%= form_for [:admin, @user] do |f| %>

When you use form_for, it assumes that the appropriate path is [model_name]_path. You have to explicitly tell it the url with

form_for @user, url: admin_user_path
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!