简体   繁体   English

缺少恒定的负载..我该如何解决? (Rails :: Plugin :: OpenID)

[英]Missing a constant on load.. how can i get around this? (Rails::Plugin::OpenID)

I have a Rails 2 project that I am trying to upgrade to Rails 3, but getting some issues with bundler. 我有一个Rails 2项目,我正在尝试升级到Rails 3,但是捆绑程序出现了一些问题。

When I run "rake", it runs the tests just fine. 当我运行“ rake”时,它可以正常运行测试。 But when I run "bundle exec rake" it fails to find a constant. 但是,当我运行“ bundle exec rake”时,它找不到常量。

The error is this: 错误是这样的:

/Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:131:in `const_missing': uninitialized constant Rails::Plugin::OpenID (NameError)
    from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/vendor/plugins/open_id_authentication/init.rb:16:in `evaluate_init_rb'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:182:in `call'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:182:in `evaluate_method'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:166:in `call'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `run'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `each'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `send'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `run'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:276:in `run_callbacks'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:51:in `send'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:631:in `prepare_dispatcher'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:185:in `process'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:113:in `send'
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:113:in `run'
    from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/config/environment.rb:9
    from ./test/test_helper.rb:2:in `require'
    from ./test/test_helper.rb:2

I have these gems installed: 我安装了以下宝石:

$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.9)
actionpack (2.3.9)
activerecord (2.3.9)
activeresource (2.3.9)
activesupport (2.3.9)
authlogic (2.1.3)
bundler (1.0.7)
gravtastic (2.2.0)
linecache (0.43)
mocha (0.9.10)
newrelic_rpm (2.13.4)
parseexcel (0.5.2)
rack (1.1.0)
rack-openid (1.1.1)
rails (2.3.9)
rake (0.8.7)
ruby-debug-base (0.10.5.jb2, 0.10.4)
ruby-debug-ide (0.4.15)
ruby-openid (2.1.8, 2.1.7, 2.0.4)
sqlite3-ruby (1.3.2)

The bundler Gemfile is as follows: 捆绑器Gemfile如下:

source 'http://rubygems.org'

#gem 'rails', '3.0.3'
gem "rails", "2.3.9"
gem "activesupport", "2.3.9"
gem "ruby-openid", "2.1.7", :require => "openid"
#gem "authlogic-oid", "1.0.4"

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', :require => 'sqlite3'

gem "authlogic", "= 2.1.3"
gem "newrelic_rpm"
#  gem "facebooker"
gem "parseexcel"
gem 'gravtastic', '= 2.2.0'
gem "rack-openid", '=1.1.1', :require => 'rack/openid'

# not sure what this does...
gem "mocha"

I have these plugins installed: 我安装了以下插件:

2dc_jqgrid      
authlogic_openid    
open_id_authentication  
squirrel

I see these similar questions: 我看到这些类似的问题:

Missing a constant on load.. how can i get around this? 缺少恒定的负载..我该如何解决?

and

Requiring gem in Rails 3 Controller failing with "Constant Missing" 要求Rails 3 Controller中的gem失败并显示“ Constant Missing”

But their solutions dont seem to work for my situation. 但是他们的解决方案似乎不适用于我的情况。

I am guessing the issue is around the plugins, but my ruby-fu is too weak. 我猜问题出在插件附近,但是我的ruby-fu太弱了。

UPDATE 更新

Getting closer, I think. 我想越来越近了。

Seems like using the plugin version of authlogic_openid is not the current route - so have switched to use the authlogic-oid gem. 似乎使用authlogic_openid插件版本不是当前路由-因此已切换为使用authlogic-oid gem。 Also seemed to have an old/different version of open_id_authentication - so updated that. 似乎也有open / id_authentication的旧版本/不同版本-对此进行了更新。

Now the exception/stack trace is as follows: 现在,异常/堆栈跟踪如下:

/Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activerecord-2.3.9/lib/active_record/base.rb:1998:in `method_missing': undefined method `openid_required_fields=' for #<Class:0x1036cccb8> (NoMethodError)
    from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/app/models/user.rb:21
    from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/authlogic-2.1.6/lib/authlogic/acts_as_authentic/base.rb:33:in `acts_as_authentic'
    from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/app/models/user.rb:16

Using these gems now: 现在使用这些宝石:

authlogic (2.1.6)
authlogic-oid (1.0.4)
rack-openid (1.2.0)
ruby-openid (2.1.8)

Seems like an issue with authlogic-oid not being loaded/init'd... my Gemfile looks like this: 好像是无法加载/初始化authlogic-oid的问题...我的Gemfile看起来像这样:

gem "ruby-openid", :require => "openid"
gem "authlogic-oid", :require => "authlogic_openid"
gem "authlogic"
gem "rack-openid", :require => 'rack/openid'

Also, the app/openid login stuff is now not working - so I guess I need to play with these the versions of these gems some more... 另外,应用程序/ openid登录信息现在不起作用-所以我想我需要更多地使用这些gem的版本...

Thanks in advance, Chris 预先感谢克里斯

(Interesting project name!) (有趣的项目名称!)

I think from the stack trace that the plugin open_id_authentication is not compatible with Rails 2, and will require Rails 3 to function. 从堆栈跟踪中我认为插件open_id_authentication与Rails 2不兼容,并且需要Rails 3起作用。

If you're upgrading to Rails 3, I'd get the project to the point where you are using the new versions of Active* and Rails before attempting a fix just for one plugin. 如果您要升级到Rails 3,那么在尝试仅针对一个插件进行修复之前,我将使该项目达到您使用Active *和Rails的新版本的地步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM