Sly
Sly

Reputation: 733

uninitialized constant ActiveSupport::Concern (NameError)

I'm using rbenv, Bundler 1.0.21, rubygems 1.8.1, Ruby v1.8.7, rails 2.3.15 and rails 3.0.18. I'm in the process of migrating my rails app from 2.3.15 to rails 3.0.18. When I switch between these versions I run "bundle install" to point to the correct set of gems. And this has worked fine until I switched from rails 3.0.18 back to 2.3.15 and ran a spec and I get:

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:466:in 
`load_missing_constant': uninitialized constant ActiveSupport::Concern (NameError)
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:106:in `const_missing'
from /Users/me/Code/repos/microplace/vendor/plugins/verification/lib/action_controller/verification.rb:3
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1418
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1416:in `class_eval'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1416
from /Users/me/Code/repos/microplace/config/environments/development.rb:12:in `load_environment'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:386:in `load_environment'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:379:in `load_environment'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:137:in `process'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:113:in `send'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:113:in `run'
from /Users/me/Dropbox/Code/repos/microplace/config/environment.rb:15
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/commands/runner.rb:39:in `require'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/commands/runner.rb:39
from script/runner:3:in `require'
from script/runner:3

Thinking that maybe there was some incompatibility issues with rubygems, I tried downgrading to versions 1.3.4, 1.4.5, and 1.5.0, with the same result.

When I run gem which rails, it gave:

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/railties-3.0.18/lib/rails.rb

So, I uninstalled railties. With the same result.

gem which activesupport returns:

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/activesupport.rb

I also tried deleting all of the gems in my .rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/ directory using this script: https://gist.github.com/IanVaughan/2902499 and reinstalled using bundle install, with the same result.

Here's my Gemfile

source :gemcutter
gem "rails", "2.3.15"
gem 'activesupport', '2.3.15'
gem "mysql"
gem "rake", "0.9.2"
gem "rack", "1.1.3"
gem "mongrel"

# bundler requires these gems in all environments
gem "nokogiri"
gem "money", "5.0.0"
gem "memcache-client"
gem "oauth"
gem "fastercsv"
gem "pdf-writer"
gem "json", "1.5.3"
gem "rmagick", :require => 'RMagick'
gem "twitter"
gem "will_paginate", "2.3.15"
gem "image_science"
gem "RubyInline"
gem "sentry"
gem "netaddr"
gem "hashie"
gem "activemerchant", "~>1.24.0"
gem "httparty"
gem "httmultiparty"
gem "ruby-hmac"
gem "mogli"
gem "SystemTimer"
gem "net-sftp"
gem "roxml"
gem "rdoc"
gem "omniauth-salesforce"
gem "xml-simple"
gem "rcov"
gem "ZenTest", "4.8.3"

group :development do
  # bundler requires these gems in development
  # gem "rails-footnotes"
end

group :test do
  # bundler requires these gems while running tests
  gem "rdoc"
  gem "rcov"
  gem "factory_girl", '2.6.4'
  gem "mocha", '< 0.13.0', :require => false
  gem "timecop"
  gem "rspec", '~> 1.3.0'
  gem "rspec-rails", '~> 1.3.4'
  gem "cucumber-rails", '~> 0.3.2'
  gem "database_cleaner", '~> 0.5.0'
  gem "webrat", '~> 0.7.0'
  gem "redgreen"
  gem "launchy"
  gem 'shoulda', :require => false
end

group :development, :test do
  gem "ruby-debug"
  #gem "ruby-debug-ide"
end

group :production, :salesforce_staging do
  gem "mongrel_cluster"
  gem "daemons"
end

Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    RubyInline (3.12.1)
      ZenTest (~> 4.3)
    SystemTimer (1.2.3)
    ZenTest (4.8.3)
    actionmailer (2.3.15)
      actionpack (= 2.3.15)
    actionpack (2.3.15)
      activesupport (= 2.3.15)
      rack (~> 1.1.3)
    active_utils (1.0.5)
      activesupport (>= 2.3.11)
      i18n
    activemerchant (1.24.0)
      active_utils (>= 1.0.2)
      activesupport (>= 2.3.11)
      builder (>= 2.0.0)
      i18n
      json (>= 1.5.1)
      money
      nokogiri
    activerecord (2.3.15)
      activesupport (= 2.3.15)
    activeresource (2.3.15)
      activesupport (= 2.3.15)
    activesupport (2.3.15)
    addressable (2.3.3)
    builder (3.2.0)
    cgi_multipart_eof_fix (2.5.0)
    color (1.4.1)
    columnize (0.3.6)
    cucumber (1.2.1)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.11.0)
      json (>= 1.4.6)
    cucumber-rails (0.3.2)
      cucumber (>= 0.8.0)
    daemons (1.1.9)
    database_cleaner (0.5.2)
    diff-lcs (1.2.1)
    factory_girl (2.6.4)
      activesupport (>= 2.3.9)
    faraday (0.8.6)
      multipart-post (~> 1.1)
    fastercsv (1.5.5)
    fastthread (1.0.7)
    gem_plugin (0.2.3)
    gherkin (2.11.5)
      json (>= 1.4.6)
    hashie (1.2.0)
    httmultiparty (0.3.8)
      httparty (>= 0.7.3)
      multipart-post
    httparty (0.10.2)
      multi_json (~> 1.0)
      multi_xml (>= 0.5.2)
    httpauth (0.2.0)
    i18n (0.6.4)
    image_science (1.2.4)
      RubyInline (~> 3.9)
    json (1.5.3)
    launchy (2.2.0)
      addressable (~> 2.3)
    linecache (0.46)
      rbx-require-relative (> 0.0.4)
    memcache-client (1.8.5)
    metaclass (0.0.1)
    mocha (0.12.10)
      metaclass (~> 0.0.1)
    mogli (0.0.28)
      httparty (>= 0.4.3)
    money (5.0.0)
      i18n (~> 0.4)
      json
    mongrel (1.1.5)
      cgi_multipart_eof_fix (>= 2.4)
      daemons (>= 1.0.3)
      fastthread (>= 1.0.1)
      gem_plugin (>= 0.2.3)
    mongrel_cluster (1.0.5)
      gem_plugin (>= 0.2.3)
      mongrel (>= 1.0.2)
    multi_json (1.6.1)
    multi_xml (0.5.3)
    multipart-post (1.2.0)
    mysql (2.9.1)
    net-sftp (2.1.1)
      net-ssh (>= 2.6.5)
    net-ssh (2.6.6)
    netaddr (1.5.0)
    nokogiri (1.5.6)
    oauth (0.4.7)
    oauth2 (0.6.1)
      faraday (~> 0.7)
      httpauth (~> 0.1)
      multi_json (~> 1.3)
    omniauth (1.1.3)
      hashie (~> 1.2)
      rack
    omniauth-oauth2 (1.0.2)
      oauth2 (~> 0.6.0)
      omniauth (~> 1.0)
    omniauth-salesforce (1.0.3)
      omniauth (~> 1.0)
      omniauth-oauth2 (~> 1.0)
    pdf-writer (1.1.8)
      color (>= 1.4.0)
      transaction-simple (~> 1.3)
    rack (1.1.3)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (2.3.15)
      actionmailer (= 2.3.15)
      actionpack (= 2.3.15)
      activerecord (= 2.3.15)
      activeresource (= 2.3.15)
      activesupport (= 2.3.15)
      rake (>= 0.8.3)
    rake (0.9.2)
    rbx-require-relative (0.0.9)
    rcov (1.0.0)
    rdoc (4.0.0)
      json (~> 1.4)
    redgreen (1.2.2)
    rmagick (2.13.2)
    roxml (3.3.1)
      activesupport (>= 2.3.0)
      nokogiri (>= 1.3.3)
    rspec (1.3.2)
    rspec-rails (1.3.4)
      rack (>= 1.0.0)
      rspec (~> 1.3.1)
    ruby-debug (0.10.4)
      columnize (>= 0.1)
      ruby-debug-base (~> 0.10.4.0)
    ruby-debug-base (0.10.4)
      linecache (>= 0.3)
    ruby-hmac (0.4.0)
    sentry (0.5.3)
    shoulda (3.0.1)
      shoulda-context (~> 1.0.0)
      shoulda-matchers (~> 1.0.0)
    shoulda-context (1.0.2)
    shoulda-matchers (1.0.0)
    simple_oauth (0.2.0)
    timecop (0.6.0)
    transaction-simple (1.4.0.2)
    twitter (4.6.0)
      faraday (~> 0.8, < 0.10)
      multi_json (~> 1.0)
      simple_oauth (~> 0.2)
    webrat (0.7.3)
      nokogiri (>= 1.2.0)
      rack (>= 1.0)
      rack-test (>= 0.5.3)
    will_paginate (2.3.15)
    xml-simple (1.1.2)

PLATFORMS
  ruby

DEPENDENCIES
  RubyInline
  SystemTimer
  ZenTest (= 4.8.3)
  activemerchant (~> 1.24.0)
  activesupport (= 2.3.15)
  cucumber-rails (~> 0.3.2)
  daemons
  database_cleaner (~> 0.5.0)
  factory_girl (= 2.6.4)
  fastercsv
  hashie
  httmultiparty
  httparty
  image_science
  json (= 1.5.3)
  launchy
  memcache-client
  mocha (< 0.13.0)
  mogli
  money (= 5.0.0)
  mongrel
  mongrel_cluster
  mysql
  net-sftp
  netaddr
  nokogiri
  oauth
  omniauth-salesforce
  pdf-writer
  rack (= 1.1.3)
  rails (= 2.3.15)
  rake (= 0.9.2)
  rcov
  rdoc
  redgreen
  rmagick
  roxml
  rspec (~> 1.3.0)
  rspec-rails (~> 1.3.4)
  ruby-debug
  ruby-hmac
  sentry
  shoulda
  timecop
  twitter
  webrat (~> 0.7.0)
  will_paginate (= 2.3.15)
  xml-simple

I'm stumped. Thanks in advance, for any ideas of how I can get past this!

Upvotes: 3

Views: 2306

Answers (1)

Sly
Sly

Reputation: 733

It turns out this issue was caused by a Rails 3 plugin I had installed, but not committed to git. So when I switched back to my Rails 2.3.15 branch, the plugin remained. (the verification plugin)

I discovered this by simply doing a recursive grep for "ActiveSupport::Concern" in my project root. I also did this in my

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems

directory, and discovered that the cucumber-rails gem instantiated ActiveSupport::Concern. From there, I loosened the versioning in the Gemfile and re-ran bundle install. This downgraded the cucumber-rails version. I don't know if cucumber-rails was also causing the error, but I suspect so, given that it was calling ActiveSupport::Concern.

Hope this helps someone else in the future!

Upvotes: 0

Related Questions