0.0
No commit activity in last 3 years
No release in over 3 years
Strips spaces from attributes, and sets empty strings to nil.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

AttrCleaner

Travis CI

Cleans up your model attributes. Strips leading and trailing space, and turns empty strings into nil.

Tested against Rails 4.2, 5.0, and 5.1.

Install

If you're using Rails with ActiveRecord all you need to do is:

gem "attr_cleaner"

Usage

Simply pass a list of attributes that you want to clean:

attr_cleaner :title, :body

Child models will inherit the attribute writers from their parent.

Other ORMs

AttrCleaner works by generating attribute setters and should work with most ORMs.

To get AttrCleaner working with your ORM just include it into your models:

include AttrCleaner::Model

Copyright

Copyright © 2018 Thomas Drake-Brockman