Sneaky Abstractions

Subscribe to my Feed, follow me on , recommend me on Working With Rails or see my code on GitHub

Sample Rails Plugin

ActsAsMonkey is a sample Rails plugin. I created it because I see many asking for information/documentation on how to write a Rails plugin, and the best way to learn how to do something is to see how it’s done, is it not? :)

So, why monkeys? Well, because when you write a plugin for Rails, if you’re not monkey patching, you’re definitely monkeying around with Rails internals. And that’s why there is so little documentation on the subject too, because there’s nothing to document. No classes, no API. Just files with arbitrary code in them. It’s a bit more orderly than that, but even so, in order to write a Rails plugin, you need to have an intimate knowledge of Ruby and Rails. You need to know how classes, modules and methods work in Ruby and which parts of Rails do the things you want to mess around with.

You can get the plugin from my repository here:

http://nimrod.interinter.net/plugins/trunk/acts_as_monkey

Other resources on writing plugins

Geoffrey Grosenbach goes through the whole process of creating a plugin in The Complete Guide to Rails Plugins part 1 and 2.

Comments

0 comments

We're sailing into a shit typhoon Randy, we'd better haul in the jib before it gets covered in shit