Rails 生成设备:视图名称错误:未初始化的常量视图
我已经遵循了railscast的#209教程 http://railscasts.com/episodes/ 209-introducing-devise?view=asciicast。它工作得很好,直到我尝试生成设计视图来自定义它(railscast 教程#210)
我做了:
rails generate devise:views
rails generate devise_views
得到以下错误:
NameError: uninitialized constant View
我正在使用 Rails 3.1.3,&与 Warden 1.0.6 一起设计 1.4.7。 有什么想法吗?
谢马特
I have followed the #209 tutorial of railscast http://railscasts.com/episodes/209-introducing-devise?view=asciicast. It was working good until I tried to generate the devise views to customize it (tutorial #210 of railscast)
I did :
rails generate devise:views
rails generate devise_views
Got the following error :
NameError: uninitialized constant View
I am using rails 3.1.3, & devise 1.4.7 with warden 1.0.6.
Any ideas ?
Tks Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己也遇到了这个问题。我不小心输入了rails g deviseviews,它实际上为devise创建了一个新模型,并为它们添加了路线。我删除了所有创建的文件,然后更正自己并输入
rails g devise:views
并开始得到您的确切错误。经过一番绞尽脑汁后,我运行了 git diff 来查看是否有其他不同,事实上它添加了一条“视图”路径。删除该路线并再次运行
rails g devise:views
后,一切都很好!希望这有帮助!
I ran into this issue myself. I accidentally typed
rails g devise views
which actually created a new model for devise, and added routes for them. I deleted all of the files that were created, then corrected myself and typedrails g devise:views
and started getting your exact error.After a bit of head scratching I ran a
git diff
to see if anything else was different, and indeed it had added a route for "views". Upon deleting that route, and runningrails g devise:views
again, all was well!Hope this helps!
您可以通过运行
railsgenerate
或railsg
找到所有生成器的列表。正确的生成器是:
我只能认为您遇到了某种版本冲突。
是否执行以下操作:
如果没有,您是否已经运行:
You can find out a list of all the generators by running
rails generate
orrails g
The correct generator is:
I can only think that you are having some sort of version conflict.
Does the following work:
If not, have you already run: