Plugin: can't call before_filter in ApplicationControlle

I expect the problem here is that your plugin init code is running
before application.rb is loaded, so you're defining a completely new
class. Since this class doesn't descend from ActionController::Base
before_filter doesn't exist.

On top of this, I think you'd find that since ApplicationController is
defined, rails would then not go and look for the
ApplicationController your application defines. You might have better
luck if you first require application_controller (forcing it to be
loaded, and then fiddle around adding filters to it.