Rails 2.1 Migration Bugs: BenchmarkForRails

Upon updating an application to Rails 2.1 the first bug I saw prevented the application from loading due to the BenchmarkForRails plugin. Here's how I fixed it.

Here's the error message I got:


/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/module/aliasing.rb:31:
  in `alias_method': 
  undefined method `prepare_application' for class `ActionController::Dispatcher' (NameError)
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/module/aliasing.rb:31:
          in `alias_method_chain'
	from /railsdevpath/vendor/plugins/benchmarkforrails/lib/benchmark_for_rails.rb:25:in `watch'
	from /railsdevpath/vendor/plugins/benchmarkforrails/init.rb:13:in `evaluate_init_rb'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin.rb:95:in `evaluate_init_rb'
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/reporting.rb:11:
          in `silence_warnings'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin.rb:91:in `evaluate_init_rb'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin.rb:44:in `load'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin/loader.rb:33:in `load_plugins'
	 ... 35 levels...
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from ./script/server:3
	from -e:2:in `load'
	from -e:2

I traced the problem to line 13 of vendor/plugins/benchmarkforrails/init.rb. Here's the code:

12  if RAILS_ENV == 'development'
13    BenchmarkForRails.watch("development mode", Dispatcher, :prepare_application)
14  end

By commenting out line 13 the app ran fine.

12  if RAILS_ENV == 'development'
13  #  BenchmarkForRails.watch("development mode", Dispatcher, :prepare_application)
14  end

Trackback URL for this post:

http://hightechsorcery.com/trackback/140
Creative Commons License Except where otherwise noted, content on this site is licensed under a Creative Commons by-nc-sa 3.0 License