这个问题可能很容易解决,但不知何故我找不到解决方案。
这适用于BOTH Authlogic和Devise。我一直在撞墙,以至于我实际上撕掉了Authlogic并重新启动了Devise - 但遇到了同样的问题。
开发一切都很好。
但是,当我开始制作时,每当我尝试使用db:seed或运行控制台时,我都会得到它。这也显示我重新启动服务器和我的gemfile。
为什么生产不能看到宝石?它似乎能够看到其他宝石就好了。
你看到的宝石是Github版本 - 这是一个推荐的修复,对我不起作用。我得到了与默认版本相同的结果,并强制使用特定版本。
Authlogic和Devise都有同样的问题,这似乎表明我的配置在生产上存在一些问题?除了Gemfile之外还有什么呢?
Dev - Rails 3.0.4,1.9.2p136 Prod - Rails 3.0.4,1.9.2p0
最后一种方法是升级Ruby以便它们匹配,但我怀疑这是问题,由于某些原因我不会进入这里会有很多工作。
ops@lightserve2:/home/proj/current$ touch tmp/restart.txt
ops@lightserve2:/home/proj/current$ r c
/home/darkserve/releases/20110217175218/config/initializers/devise.rb:3:in `<top (required)>': uninitialized constant Devise (NameError)
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/engine.rb:200:in `each'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `instance_exec'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `run'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `each'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `run_initializers'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/application.rb:134:in `initialize!'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
from /home/darkserve/releases/20110217175218/config/environment.rb:5:in `<top (required)>'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/application.rb:103:in `require_environment!'
from /home/ops/shared/bundle/ruby/1.9.1/gems/railties-3.0.4/lib/rails/commands.rb:22:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ops@lightserve2:/home/darkserve/current$ cat Gemfile.lock
GIT
remote: http://github.com/JonasNielsen/nifty-generators.git
revision: 432d05d55b55e030d6c16b9d71b392181bca45f8
specs:
nifty-generators (0.4.3)
GIT
remote: http://github.com/plataformatec/devise.git
revision: 7113beac81a12da06be2d08bbfaec79017e9fdbf
specs:
devise (1.2.rc)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
GEM
remote: http://rubygems.org/
specs:
aaronh-chronic (0.3.9)
abstract (1.0.0)
actionmailer (3.0.4)
actionpack (= 3.0.4)
mail (~> 2.2.15)
actionpack (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.4)
activesupport (= 3.0.4)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
activesupport (3.0.4)
arel (2.0.8)
bcrypt-ruby (2.1.4)
builder (2.1.2)
capistrano (2.5.19)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.0.0)
crack (0.1.8)
erubis (2.6.6)
abstract (>= 1.0.0)
foreigner (0.9.1)
haml (3.0.25)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
haml (~> 3.0)
railties (~> 3.0)
highline (1.6.1)
hpricot (0.8.3)
httparty (0.7.4)
crack (= 0.1.8)
i18n (0.5.0)
json (1.5.1)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mash (0.1.1)
mime-types (1.16)
mocha (0.9.12)
mysql2 (0.2.6)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.1.0)
net-ssh-gateway (1.0.1)
net-ssh (>= 1.99.1)
nokogiri (1.4.4)
oauth (0.4.4)
orm_adapter (0.0.4)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.4)
actionmailer (= 3.0.4)
actionpack (= 3.0.4)
activerecord (= 3.0.4)
activeresource (= 3.0.4)
activesupport (= 3.0.4)
bundler (~> 1.0)
railties (= 3.0.4)
railties (3.0.4)
actionpack (= 3.0.4)
activesupport (= 3.0.4)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
ruby-freshbooks (0.4.0)
builder (>= 2.1.2)
httparty (>= 0.5.0)
ruby_parser (2.0.5)
sexp_processor (~> 3.0)
sexp_processor (3.0.5)
simple_form (1.3.1)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.24)
warden (1.0.3)
rack (>= 1.0.0)
whenever (0.6.2)
aaronh-chronic (>= 0.3.9)
activesupport (>= 2.3.4)
yammer4r (0.1.5)
json (>= 1.1.7)
mash (>= 0.0.3)
oauth (>= 0.3.5)
PLATFORMS
ruby
DEPENDENCIES
bcrypt-ruby
capistrano
devise!
foreigner
haml
haml-rails
hpricot
mocha
mysql2
nifty-generators!
nokogiri
rails (= 3.0.4)
ruby-freshbooks
ruby_parser
simple_form
whenever
yammer4r
答案 0 :(得分:0)
任何机会......
的Gemfile
group :development do
gem 'devise'
end
答案 1 :(得分:0)
问题原来是这个片上安装了另一个rails应用程序,并且rake / rails因为配置错误而试图在运行时调用其他应用程序的rake / rails脚本。
通过在我的应用程序的/ script目录中强制使用rails脚本,可以在短期内解决问题。例如。
ruby script/rails console
而不是
rails console
然而,我没有找到一种方法来轻松强制我自己的耙子副本。