Undefined method `instance' for Rack::MiniProfiler:Class on Rails server startup


#1

I see this error when I fire up the development server with rails s:

/home/tbh/.rvm/gems/[email protected]/gems/rack-mini-profiler-0.1.7/lib/mini_profiler/storage/file_store.rb:43:in 'block in initialize': undefined method 'instance' for Rack::MiniProfiler:Class (NoMethodError)

Rails 3.0.10
Ruby 1.9.2-p290
Rack 1.2.4


#2

Got the same error with Rails 3.2.6, Ruby 1.9.3p194, Rack 1.4.1


#3

I really need a Gemfile AND Gemfile.lock to diagnose these issues. Would be awesome helpful.


#4

Here’s my Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.6'
gem 'jquery-rails'
gem 'haml-rails'
gem 'simple_form'

gem "mongoid", "~> 2.4"
gem "bson_ext", "~> 1.5"

gem 'sorcery', :github => 'NoamB/sorcery'
gem 'cancan'
gem 'gravtastic'
gem 'kaminari'

gem 'rack-mini-profiler'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platform => :ruby
  gem 'uglifier', '>= 1.0.3'
  gem 'bootstrap-sass'
end

group :development do
  gem 'thin'
  gem 'quiet_assets'
  gem 'debugger'

  gem 'guard', :require => false
  gem 'guard-rspec', :github => 'guard/guard-rspec', :branch => 'guard_1_1', :require => false
  gem 'guard-cucumber', :require => false
  # guard-jasmine needs PhantomJS
  # see http://code.google.com/p/phantomjs/wiki/BuildInstructions#Mac_OS_X
  gem 'guard-jasmine', :require => false
  gem 'growl', :require => false

  gem 'capistrano', :require => false
  gem 'capistrano-ext', :require => false
  gem 'rvm-capistrano', :require => false

  gem 'hirb', :require => false
  gem 'wirble', :require => false

  gem 'brakeman', :require => false
end

group :test, :development do
  gem "rspec-rails", :require => false
  gem "jasminerice"
  gem "spork", :require => false
  gem "guard-spork", :github => 'guard/guard-spork', :branch => 'guard_1_1', :require => false
end

group :test do
  gem 'cucumber-rails', :require => false
  gem 'factory_girl_rails', '~> 3.0'
  gem 'capybara'
  gem 'database_cleaner'
  gem 'launchy'
end

group :production do
  gem 'unicorn'
  gem 'airbrake'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

And the Gemfile.lock

    GIT
  remote: git://github.com/NoamB/sorcery.git
  revision: 7912e9f38f366f78d0dda1dcf2a886e90925fd1e
  specs:
    sorcery (0.7.12)
      bcrypt-ruby (~> 3.0.0)
      oauth (~> 0.4.4)
      oauth2 (~> 0.5.1)

GIT
  remote: git://github.com/guard/guard-rspec.git
  revision: 1e60d32f966e60937a9893b69ba87dd1b0bb6a54
  branch: guard_1_1
  specs:
    guard-rspec (0.7.2)
      guard (>= 0.10.0)

GIT
  remote: git://github.com/guard/guard-spork.git
  revision: 41397ac9bf43d25d3781bd37539076f7b490df52
  branch: guard_1_1
  specs:
    guard-spork (0.8.0)
      guard (>= 0.10.0)
      spork (>= 0.8.4)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.6)
      actionpack (= 3.2.6)
      mail (~> 2.4.4)
    actionpack (3.2.6)
      activemodel (= 3.2.6)
      activesupport (= 3.2.6)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.3)
    activemodel (3.2.6)
      activesupport (= 3.2.6)
      builder (~> 3.0.0)
    activerecord (3.2.6)
      activemodel (= 3.2.6)
      activesupport (= 3.2.6)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.6)
      activemodel (= 3.2.6)
      activesupport (= 3.2.6)
    activesupport (3.2.6)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    addressable (2.2.8)
    airbrake (3.0.9)
      activesupport
      builder
    arel (3.0.2)
    bcrypt-ruby (3.0.1)
    bootstrap-sass (2.0.4.0)
    brakeman (1.6.2)
      activesupport
      erubis (~> 2.6)
      fastercsv (~> 1.5)
      haml (~> 3.0)
      highline (~> 1.6)
      i18n
      json_pure
      ruby2ruby (~> 1.2)
      ruby_parser (= 2.3.1)
      sass (~> 3.0)
      terminal-table (~> 1.4)
    bson (1.6.2)
    bson_ext (1.6.2)
      bson (~> 1.6.2)
    builder (3.0.0)
    cancan (1.6.7)
    capistrano (2.12.0)
      highline
      net-scp (>= 1.0.0)
      net-sftp (>= 2.0.0)
      net-ssh (>= 2.0.14)
      net-ssh-gateway (>= 1.1.0)
    capistrano-ext (1.2.1)
      capistrano (>= 1.0.0)
    capybara (1.1.2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 0.1.4)
    childprocess (0.3.2)
      ffi (~> 1.0.6)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.3)
    columnize (0.3.6)
    cucumber (1.2.0)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.10.0)
      json (>= 1.4.6)
    cucumber-rails (1.3.0)
      capybara (>= 1.1.2)
      cucumber (>= 1.1.8)
      nokogiri (>= 1.5.0)
    daemons (1.1.8)
    database_cleaner (0.8.0)
    debugger (1.1.3)
      columnize (>= 0.3.1)
      debugger-linecache (~> 1.1.1)
      debugger-ruby_core_source (~> 1.1.2)
    debugger-linecache (1.1.1)
      debugger-ruby_core_source (>= 1.1.1)
    debugger-ruby_core_source (1.1.3)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    eventmachine (0.12.10)
    execjs (1.4.0)
      multi_json (~> 1.0)
    factory_girl (3.3.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (3.3.0)
      factory_girl (~> 3.3.0)
      railties (>= 3.0.0)
    faraday (0.8.1)
      multipart-post (~> 1.1)
    fastercsv (1.5.5)
    ffi (1.0.11)
    gherkin (2.10.0)
      json (>= 1.4.6)
    gravtastic (3.2.6)
    growl (1.0.3)
    guard (1.1.0)
      listen (>= 0.4.2)
      thor (>= 0.14.6)
    guard-cucumber (1.0.0)
      cucumber (>= 1.2.0)
      guard (>= 1.1.0)
    guard-jasmine (1.3.0)
      childprocess
      guard (>= 1.1.0)
      multi_json
      thor
    haml (3.1.6)
    haml-rails (0.3.4)
      actionpack (~> 3.0)
      activesupport (~> 3.0)
      haml (~> 3.0)
      railties (~> 3.0)
    highline (1.6.12)
    hike (1.2.1)
    hirb (0.6.2)
    i18n (0.6.0)
    jasminerice (0.0.9)
      coffee-rails
      haml
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.7.3)
    json_pure (1.7.3)
    kaminari (0.13.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
      railties (>= 3.0.0)
    kgio (2.7.4)
    launchy (2.1.0)
      addressable (~> 2.2.6)
    libv8 (3.3.10.4)
    libwebsocket (0.1.3)
      addressable
    listen (0.4.2)
      rb-fchange (~> 0.0.5)
      rb-fsevent (~> 0.9.1)
      rb-inotify (~> 0.8.8)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.18)
    mongo (1.6.2)
      bson (~> 1.6.2)
    mongoid (2.4.10)
      activemodel (~> 3.1)
      mongo (~> 1.3)
      tzinfo (~> 0.3.22)
    multi_json (1.3.6)
    multipart-post (1.1.5)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-sftp (2.0.5)
      net-ssh (>= 2.0.9)
    net-ssh (2.5.2)
    net-ssh-gateway (1.1.0)
      net-ssh (>= 1.99.1)
    nokogiri (1.5.3)
    oauth (0.4.6)
    oauth2 (0.5.2)
      faraday (~> 0.7)
      multi_json (~> 1.0)
    polyglot (0.3.3)
    quiet_assets (1.0.1)
      railties (~> 3.1)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-mini-profiler (0.1.7)
      rack (>= 1.1.3)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.6)
      actionmailer (= 3.2.6)
      actionpack (= 3.2.6)
      activerecord (= 3.2.6)
      activeresource (= 3.2.6)
      activesupport (= 3.2.6)
      bundler (~> 1.0)
      railties (= 3.2.6)
    railties (3.2.6)
      actionpack (= 3.2.6)
      activesupport (= 3.2.6)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    raindrops (0.9.0)
    rake (0.9.2.2)
    rb-fchange (0.0.5)
      ffi
    rb-fsevent (0.9.1)
    rb-inotify (0.8.8)
      ffi (>= 0.5.0)
    rdoc (3.12)
      json (~> 1.4)
    rspec (2.10.0)
      rspec-core (~> 2.10.0)
      rspec-expectations (~> 2.10.0)
      rspec-mocks (~> 2.10.0)
    rspec-core (2.10.1)
    rspec-expectations (2.10.0)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.10.1)
    rspec-rails (2.10.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.10.0)
    ruby2ruby (1.3.1)
      ruby_parser (~> 2.0)
      sexp_processor (~> 3.0)
    ruby_parser (2.3.1)
      sexp_processor (~> 3.0)
    rubyzip (0.9.8)
    rvm-capistrano (1.2.2)
      capistrano (>= 2.0.0)
    sass (3.1.19)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.22.1)
      childprocess (>= 0.2.5)
      ffi (~> 1.0)
      libwebsocket (~> 0.1.3)
      multi_json (~> 1.0)
      rubyzip
    sexp_processor (3.2.0)
    simple_form (2.0.2)
      actionpack (~> 3.0)
      activemodel (~> 3.0)
    spork (0.9.2)
    sprockets (2.1.3)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    terminal-table (1.4.5)
    therubyracer (0.10.1)
      libv8 (~> 3.3.10)
    thin (1.3.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.15.3)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.33)
    uglifier (1.2.4)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    unicorn (4.3.1)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    wirble (0.1.3)
    xpath (0.1.4)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  airbrake
  bootstrap-sass
  brakeman
  bson_ext (~> 1.5)
  cancan
  capistrano
  capistrano-ext
  capybara
  coffee-rails (~> 3.2.1)
  cucumber-rails
  database_cleaner
  debugger
  factory_girl_rails (~> 3.0)
  gravtastic
  growl
  guard
  guard-cucumber
  guard-jasmine
  guard-rspec!
  guard-spork!
  haml-rails
  hirb
  jasminerice
  jquery-rails
  kaminari
  launchy
  mongoid (~> 2.4)
  quiet_assets
  rack-mini-profiler
  rails (= 3.2.6)
  rspec-rails
  rvm-capistrano
  sass-rails (~> 3.2.3)
  simple_form
  sorcery!
  spork
  therubyracer
  thin
  uglifier (>= 1.0.3)
  unicorn
  wirble

#5

The problem seems to be the mongoid gem version 2.x. Removing just this gem the error does not appear.

I then updated to mongoid 3.0.2 and MiniProfiler just works as expected (profiling everthing but queries).


#6

I have a local repro with mongoid 2.4.3, trying to figure out what it was up to


#7

Just checked in a fix, will do another release on monday


#8

should be fixed in latest, please confirm


#9

Yes, works fine! Well done. Thank you


#10

can I have a copy of your Gemfile and Gemfile.lock?


#11

will try to repro here, same error as above?


#12

you getting the same error as above


#13

interesting, I will try to repro and see what is up