August 16, 2010

Some lessons about Ruby Plugins

Kevin Hallmark @ 11:25 am —

So I have been having trouble getting plugins working with my Ruby app. I followed the directions here: http://peepcode.com/products/rails-2-plugin-patterns and it was working pretty well.

However, I came across two “gotcha’s” that gave me a little trouble.

  1. You have to include init.rb
    This fact was not readily apparent to me, I thought ruby would just take care of it. In my case, I had to add the init.rb into the app. This is probably obvious to you Ruby veterans, but not me as a n00b.
  2. You have to include your plugin’s file into init.rb
    Again, this seems like a no brainer. It’s not. You have to add each file you want your plugin to us to some file included by init.rb.

Obligatory plug for the peepcode above. If you’re just learning about plugins and Ruby, that peepcode is worth every penny

Leave a Reply

Logged in as . (Logout)