如何在Rails 2.3.14应用程序中配置memprof?

时间:2012-07-06 05:57:00

标签: ruby-on-rails ruby ruby-on-rails-2 memprof

我在配置/初始化程序中添加了这些行

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

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

获取此错误

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 个答案:

答案 0 :(得分:0)

而不是

config.middlewares.use(Memprof::Middleware)

config.middleware.use(Memprof::Middleware)