Few days ago we had updated the application on which project currently I am working to make it compatible with rails 2.1.0. Previously we were using rails 1.2.5. In our application we have mail sending module for which we are using activemessaging plugin. It was working fine on previous version. But, unfortunately on new version it was not working. We thought that we made some mistake while updating to the new version. The problem was the poller was not starting and it was showing the following message when we were trying to run the poller-
Dispatch exception: undefined method `prepare_application' for #Dispatcher:0xb6d9ffec>
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/support.rb:8:in `prepare_application_for_dispatch'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:189:in `prepare_application'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:199:in `dispatch'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:197:in `synchronize'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:197:in `dispatch'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:93:in `stop'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:90:in `start'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:90:in `stop'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:80:in `each'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:80:in `stop'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:67:in `start'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/lib/activemessaging.rb:108:in `start'
/mnt/app/releases/20081017130017/vendor/plugins/activemessaging/poller.rb:14
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `load'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `start_load'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:253:in `start'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/controller.rb:72:in `run'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:139:in `run'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions'
/var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:138:in `run'
script/poller:21
After googling I found that the plugin has a problem to work with rails 2.1.0. http://groups.google.com/group/activemessaging-discuss/browse_thread/thread/41989b6599146ba4- - in this site you will find the details. After replacing the content of vendor/activemessaginglib/activemessaging/support.rb with the following code the poller was working fine -
require 'dispatcher' unless defined?(::Dispatcher)
::Dispatcher.class_eval do
def self.prepare_application_for_dispatch
new(STDOUT).reload_application
end
def self.reset_application_after_dispatch
new(STDOUT).cleanup_application
end
end
It is really bad if someone needs to do such things to make the plugins working while updating any project to any newer rails version.