This project is archived and is in readonly mode.

#3130 ✓invalid
Josh Sharpe

[PATCH] add strip_attributes support to ActiveModel and Active Record

Reported by Josh Sharpe | September 1st, 2009 @ 03:22 PM

Added support for ActiveModel#strip_attributes and ActiveRecord::Base.strip_attributes!

ActiveModel#strip_attributes removes leading and trailing
white spaces from all applicable attributes.

ActiveRecord::Base.strip_attributes! adds a before_validation
filter to your class which calls ActiveModel#strip_attributes.

Both support :only and :except as options.

This is useful for cleaning up form-inputted attributes.

This patch has been rebased for master.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages