4

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

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
4

1 回答 1

0

代替

config.middlewares.use(Memprof::Middleware)

尝试

config.middleware.use(Memprof::Middleware)
于 2012-09-25T09:48:19.167 回答