CodeRay is a popular syntax highlighter written in Ruby that supports quite a few languages. Unfortunately, there's not much documentation on getting it to work with Rails. Here, I explain how to turn it into a Rails plugin.
Checkboxes are an intuitive way to control many-to-many relationships. There are several implementations floating around the Web, but none that I've seen works with form_for or fields_for. In this article, I explain how virtual attributes and method_missing make it possible for a form_for to transparently control a many-to-many relationship.
REST is quickly gaining ground as a way to make web apps talk to each other. But implementing it in Rails can be confusing for beginners, due in no small part to the rather lacking documentation of the big picture. In this article, I explain how ActiveResource, routing, and RESTful controller design fit together.
error_message_on gives you a flexible way to display validation errors, but unfortunately, it assumes that you want the messages printed inside <div> tags. A quick patch replaces the <div>s with <span>s, which are valid in a broader range of contexts.
If you run your Rails app through Fast-CGI, turning on page caching may very well break your resources. Specifically, when you try to create, update, or delete a resource, you'll either see the index or show method instead of what you intended. Here, I show you a fix using .htaccess.
Copyright 2010 by Jarrett Colby