开发者

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

开发者 https://www.devze.com 2023-02-01 11:11 出处:网络
I have a Rails 2 project that I am trying to upgrade to Rails 3, but getting some issues with bundler.

I have a Rails 2 project that I am trying to upgrade to Rails 3, but getting some issues with bundler.

When I run "rake", it runs the tests just fine. But when I run "bundle exec rake" it fails to find a constant.

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/.rv开发者_如何转开发m/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:

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"

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.

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. Also seemed to have an old/different version of open_id_authentication - so updated that.

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:

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...

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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消