如何更改默认的 Devise 视图路径?
我正在使用 Devise 开发 Rails 项目。默认情况下,所有 Devise 视图都会转到 app/views/devise/...
相反,我希望将它们放在 /app/views/users/...
中,例如:
app/views/users/sessions
app/views/users /registration
- 等。
我已经了解了 railsgenerate devise:viewsusers
,但还涉及一些代码更改。
我不想改变控制器。我只想在与默认目录不同的目录中查看视图。
I am developing a Rails project with Devise. By default all Devise views go to app/views/devise/...
I would like instead, to have them in /app/views/users/...
like:
app/views/users/sessions
app/views/users/registration
- etc.
I got as far as rails generate devise:views users
, but there is also some code change involved.
I don't want to change the controllers. I just want to have views in a different directory than the default one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在不更改控制器的情况下,您无法更改设计视图的默认文件夹。
我建议如果您想有不同的观点,那么只需在设计视图中进行更改即可。
I think without changing the controller you cant change the default folder for devise views.
I suggest if you want to have different views then just make your changes in devise views.