acts_as_formatted 0.1 is out

by Carl Mercier

I was doing a little Ruby on Rails hacking and I needed an easy way to automatically format ActiveRecord string columns. I was surprised that this wasn’t built into Rails already, and even more when I couldn’t find a 3rd party plugin that did that. I guess the open source community was calling on me to write my own!

I’m glad to introduce acts_as_formatted 0.1. Here’s an example of how it works. As you can see, it is pretty straightforward:

class Person < ActiveRecord::Base
acts_as_formatted :case => :capitalize, :except => :suffix
end

This snippet formats all string fields by Capitalizing the first letter of a string, and by stripping leading and trailing white spaces. No more custom setters. acts_as_formatted can also change the case to UPPERCASE, lowercase or sWAP cASE. Check out the README for more details on usage and installation instructions. Comments are welcome, of course!