71884

Missing a constant on load.. how can i get around this?

Question:

I just installed bundler for a rails 2.3.5 Spree project.

After doing so, I realized that I was getting this error when I went to script/console :

Loading development environment (Rails 2.3.5) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing':NameError: uninitialized constant Rails::Plugin::OpenID

<strong>My Gemfile :</strong>

gem 'ruby-openid', '2.1.8'

I ran bundle install with no errors.

<strong>>> gem list -d ruby-openid</strong>

*** LOCAL GEMS *** ruby-openid (2.1.8, 2.1.2) Author: JanRain, Inc Homepage: http://github.com/openid/ruby-openid Installed at (2.1.8): /Library/Ruby/Gems/1.8 (2.1.2): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

<strong>Full Backtrace</strong>

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant Rails::Plugin::OpenID (NameError) from /Users/macuser/Sites/test/spree/vendor/plugins/open_id_authentication/init.rb:16:in `evaluate_init_rb' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `evaluate_method' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `send' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `send' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks' from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:631:in `prepare_dispatcher' from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:185:in `process' from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send' from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run' from ./script/../config/../lib/spree/initializer.rb:90:in `run' from /Users/macuser/Sites/test/spree/config/environment.rb:26 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84 from script/server:3:in `require' from script/server:3

Any clues as to what to inspect now? Thanks ahead!

Answer1:

I've seen mention of this before - I think it might have to do with require syntax in the Gemfile...

I just hacked a Gemfile together and threw in...

gem "ruby-openid", :require => 'openid'

Was able to fire up console in an admittedly scaled-down test environment...

Recommend

  • Issue with rake gem:install
  • Load only what classes are being used in Ruby?
  • Problems Calling a Java Class from JRuby
  • Sharing synchronization objects through global namespace vs as a function argument
  • “Failed create pod sandbox” pod error in AWS Kubernetes cluster
  • Error with dplyr group_by
  • Heroku rake task uninitialized constant for MongoMapper model
  • pundit policies with namespaces
  • How to reinstall Ruby and Gem on Mac OS X
  • How to silence gem errors after switching to bundler
  • understanding the execution flow in python
  • Using Rails Inflections with `rails generate`
  • Chinese and Japanese character encoding issues when exporting HTML to PDF
  • devise gem install for Ruby on Rails
  • How to fix ruby error: sh: 1: make: not found
  • Will volatile protect me from all behind-the-scenes multi-threading hazards?
  • rvm and bundle install in Ubuntu 12.10: Errno::EACCES
  • Array resizing and realloc function
  • Installing Informix Client SDK on Raspberry pi
  • Is there any gem/plugin available to create your own url shortener service using ruby on rails
  • Bundler using old version
  • TypeError: Cannot visit Mail::Multibyte::Chars
  • Why won't my rails spec run?
  • How do I run my Specs with the previous version of Rspec?
  • How to reply a tweet using the Twitter gem?
  • how to reopen a class in gems
  • Show message when Tform2 is created?
  • Pass nested C++ vector as built-in style multi-dimensional array
  • How to write string.Contains(someText) in expression Tree
  • What do I do with this error when I run tests in rails?
  • Heroku push rejected - Hartl's Rails 3.2 tutorial
  • python: forcing relative imports to search from script file
  • Jenkins Grails plugin does not list lastest versions of Grails
  • Iron Router: How do I send data to the layout?
  • NUnit 3.0 TestCase const custom object arguments
  • Ember.js model to be organised as a tree structure
  • How to generate and display a QR Code in ionic 2
  • Time complexity of a program which involves multiple variables
  • Could not find rake using whenever rails
  • why do I get the error when installing the gem 'pg'? [duplicate]