In my application I have used ruby 1.9.2 and rails 3.0.3 and have also installed Devise gem.The problem begins when I run the Webrick server I get uninitialized constant Devise name Error.
在我的应用程序中,我使用了ruby 1.9.2和rails 3.0.3并且还安装了Devise gem。问题在我运行Webrick服务器时开始我得到未初始化的常量设计名称错误。
/home/app/Workspace/project/Library_Management/Library_Management/config/initializers/devise.rb:3:in `<top (required)>': uninitialized constant Devise (NameError)
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/engine.rb:200:in `each'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /home/app/Workspace/project/Library_Management/Library_Management/config/environment.rb:5:in `<top (required)>'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/app/Workspace/project/Library_Management/Library_Management/config.ru:3:in `block in <main>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /home/app/Workspace/project/Library_Management/Library_Management/config.ru:1:in `new'
from /home/app/Workspace/project/Library_Management/Library_Management/config.ru:1:in `<main>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/server.rb:65:in `start'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:27:in `<top (required)>'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in `require'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in `rescue in require'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
Thanks
谢谢
10 个解决方案
#1
15
Check your config/application.rb, you need to add require 'devise' and you should be fine.
检查你的config / application.rb,你需要添加require'devise',你应该没问题。
#2
14
In case you are writing an engine which has its own devise config, just add
如果您正在编写具有自己的设备配置的引擎,请添加
require 'devise'
on the beginning of devise initializer. In my case I had no devise requirement within application :)
在设计初始化器的开头。在我的情况下,我在应用程序中没有设计要求:)
Cheers
干杯
#3
4
Make sure you've listed Devise in your Gemfile and run bundle install
.
确保您已在Gemfile中列出Devise并运行bundle install。
#4
3
I got an error like that when I had a custom devise controller to override the 'new' method to do some custom stuff, and forgot to use 'super'
当我有一个自定义设计控制器覆盖'新'方法来做一些自定义的东西,并忘了使用'超'时,我得到了一个错误
Do you have a custom controller?
你有自定义控制器吗?
#5
2
I had a similar issue and i found this https://github.com/plataformatec/devise
我有一个类似的问题,我发现这个https://github.com/plataformatec/devise
It says you have to do
它说你必须做
rails generate devise:install
rails generate devise:install
Following "Getting Started" on that page got me going
在该页面上的“入门”后,我开始了
#6
1
if you are not using devise gem anymore then remove
如果你不再使用设计宝石,那么删除
gem 'devise'
from gemfile and delete
来自gemfile和删除
config/initializers/devise.rb
also make sure devise is not being used anywhere
还要确保设备没有在任何地方使用
#7
1
I just had that issue, it was because I generated a view model by mistake and I didnt delete it from my routes.rb
我只是遇到了这个问题,这是因为我错误地生成了一个视图模型而且我没有从routes.rb中删除它
#8
1
I had to add require 'devise'
in the spec/spec_helper.rb file and that error went away.
我不得不在spec / spec_helper.rb文件中添加require'devise',并且该错误消失了。
#9
0
I added few columns after I install Devise and I added some validations in my user model. From error message, it looks like rails cannot find the essential library therefore it can't find Devise. Maybe checkout the Github devise Wiki page and makes sure all the dependencies are satisfied?
我在安装Devise之后添加了几列,并在我的用户模型中添加了一些验证。从错误消息,它看起来像铁路找不到必要的库因此它找不到Devise。也许签出Github设计Wiki页面并确保所有依赖项都满意?
Hope it helps!
希望能帮助到你!
#10
0
In your config/application.rb add require 'yaml'
. It works for me. Try
在你的config / application.rb中添加require'yaml'。这个对我有用。尝试
#1
15
Check your config/application.rb, you need to add require 'devise' and you should be fine.
检查你的config / application.rb,你需要添加require'devise',你应该没问题。
#2
14
In case you are writing an engine which has its own devise config, just add
如果您正在编写具有自己的设备配置的引擎,请添加
require 'devise'
on the beginning of devise initializer. In my case I had no devise requirement within application :)
在设计初始化器的开头。在我的情况下,我在应用程序中没有设计要求:)
Cheers
干杯
#3
4
Make sure you've listed Devise in your Gemfile and run bundle install
.
确保您已在Gemfile中列出Devise并运行bundle install。
#4
3
I got an error like that when I had a custom devise controller to override the 'new' method to do some custom stuff, and forgot to use 'super'
当我有一个自定义设计控制器覆盖'新'方法来做一些自定义的东西,并忘了使用'超'时,我得到了一个错误
Do you have a custom controller?
你有自定义控制器吗?
#5
2
I had a similar issue and i found this https://github.com/plataformatec/devise
我有一个类似的问题,我发现这个https://github.com/plataformatec/devise
It says you have to do
它说你必须做
rails generate devise:install
rails generate devise:install
Following "Getting Started" on that page got me going
在该页面上的“入门”后,我开始了
#6
1
if you are not using devise gem anymore then remove
如果你不再使用设计宝石,那么删除
gem 'devise'
from gemfile and delete
来自gemfile和删除
config/initializers/devise.rb
also make sure devise is not being used anywhere
还要确保设备没有在任何地方使用
#7
1
I just had that issue, it was because I generated a view model by mistake and I didnt delete it from my routes.rb
我只是遇到了这个问题,这是因为我错误地生成了一个视图模型而且我没有从routes.rb中删除它
#8
1
I had to add require 'devise'
in the spec/spec_helper.rb file and that error went away.
我不得不在spec / spec_helper.rb文件中添加require'devise',并且该错误消失了。
#9
0
I added few columns after I install Devise and I added some validations in my user model. From error message, it looks like rails cannot find the essential library therefore it can't find Devise. Maybe checkout the Github devise Wiki page and makes sure all the dependencies are satisfied?
我在安装Devise之后添加了几列,并在我的用户模型中添加了一些验证。从错误消息,它看起来像铁路找不到必要的库因此它找不到Devise。也许签出Github设计Wiki页面并确保所有依赖项都满意?
Hope it helps!
希望能帮助到你!
#10
0
In your config/application.rb add require 'yaml'
. It works for me. Try
在你的config / application.rb中添加require'yaml'。这个对我有用。尝试