Cleans up your model attributes. Strips leading and trailing space, and turns
empty strings into
Tested against Rails 4.2 and 5.0.
If you're using Rails with ActiveRecord all you need to do is:
Simply pass a list of attributes that you want to clean:
attr_cleaner :title, :body
Child models will inherit the attribute list from their parent by default.
AttrCleaner will also work with any ORM that writes attributes via a method
To get AttrCleaner working with your ORM just include it into your models:
Copyright © 2010 Thomas Drake-Brockman