acts_as_stripped Now Available

Ryan Sonnek bio photo By Ryan Sonnek

In my experience, it’s very common for web frameworks to automatically strip extra whitespace from posted forms.  Wicket, for example just does the “right thing” by default, and it genuinely surprised me when I found out that Ruby on Rails does not do this by default.

Rails is a wonderfully pluggable framework, and so I’ve published a Ruby gem which will strip out extra whitespace for any string attributes.  It’s called acts_as_stripped and can be found on github at  The Rails community is all about sexy project names, but I just couldn’t make myself name this little plugin “stripper”.  :)

Usage of this plugin is incredibly simple:

strip whitespace from all string attributes

class User   acts_as_stripped


strip whitespace from select string attributes

class Post   acts_as_stripped :title, :summary


Drop me a line if there are any questions or suggestions.  The nice benefit of using this plugin is that it works with any ActiveRecord model object and is not directly tied to the Rails web framework. 

This plugin was inspired by this post: