dm-trimmer

DataMapper plugin to remove leading and trailing blanks from property values.

Leading and trailing spaces on property values can be a problem. They’re almost never wanted nor intended. In fact, Oracle actually treats empty strings as NULL. That’s not to say I necessarily think that the database should be messing with our data mind you but it does show that at least someone agrees with me.

Here’s an example of what happens when the plugin is installed:

u = User.new

u.name = “ Simon Harris ” # => “Simon Harris”

	u.name = "                   "	# => nil