RoR plugin woes

I’m been doing a lot of work with RoR plugins trying to make things generic. The RoR plugin mechanism is just plain horrible. Plugins do not work like most ruby classes because they are loaded in a slightly convoluted way and most errors end up getting swallowed by RoR. Of course this can be fixed, but it is really annoying and makes programming even more stone-age than it should be. You end up with errors like this:

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123: in `const_missing': uninitialized constant AjaxValidation (NameError)
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `const_missing'
        from script/../config/../vendor/plugins/ajax_validation/init.rb:3: in `load_plugin'

The issue here is NOT that AjaxValidation isn’t defined. Instead, it is that in the definition of AjaxValidation an error has occurred and this caused the load of AjaxValidation to completely fail AND there is absolutely no logging of the error that caused AjaxValidation to fail. So, you resort to writing to stdout each line of code to figure out where the problem is. That sucks.

Another issue I have with plugins is that I cannot define standard action methods in a plugin. There should be a mechanism for doing this. The issue seems to be that how RoR is handling action method invocation is not standard reflection because this would mean that all methods on the object could be actions. Instead it only allows the methods defined in a controller to be called. This makes sense, but makes life hard on plugin developers.

One thought on “RoR plugin woes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s