How to configure memprof in a Rails 2.3.14 application?

202 views Asked by At

I have added these lines in my config/initializer

require 'memprof/middleware'
config.middlewares.use(Memprof::Middleware)

require 'memprof/tracer'
config.middleware.insert(0, Memprof::Tracer)

Getting this error

config/environments/development.rb:98:in `load_environment': undefined method `middlewares' for #<Rails::Configuration:0xb73dd47c> (NoMethodError)
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:386:in `load_environment'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:379:in `load_environment'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:137:in `process'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `send'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `run'
    from /home/krunals/ms/trunk/2012-06-18-01-MangoApps/config/environment.rb:22
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:49:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:49:in `require'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/commands/server.rb:84
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:49:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:49:in `require'
    from script/server:3
1

There are 1 answers

0
wpp On

instead of

config.middlewares.use(Memprof::Middleware)

try

config.middleware.use(Memprof::Middleware)