This project is archived and is in readonly mode.
[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
-
CancelProfileIsBroken September 25th, 2009 @ 12:36 PM
- Tag changed from 3.0, activemodel, activerecord, strip_attribtutes to 3.0, activemodel, activerecord, bugmash, strip_attribtutes
-
Blue Box Jesse September 27th, 2009 @ 01:16 AM
BugMash: +1
Applies to master cleanly. Do not see any related errors as a result of the patch.
Good idea / useful tool.
-
sr.iniv.t September 27th, 2009 @ 07:57 AM
+1 verified.
Great idea - i have run into situations where we needed this kind of behavior would have been helpful. The patch applies without any problems and all tests pass.
-
CancelProfileIsBroken September 27th, 2009 @ 11:57 AM
- Tag changed from 3.0, activemodel, activerecord, bugmash, strip_attribtutes to 3.0, activemodel, activerecord, bugmash-review, strip_attribtutes
-
Rizwan Reza January 18th, 2010 @ 02:06 PM
- Tag changed from 3.0, activemodel, activerecord, bugmash-review, strip_attribtutes to 3.0, activemodel, activerecord, bugmash, strip_attribtutes
The patch doesn't apply to master anymore.
-
Prem Sichanugrist (sikachu) January 20th, 2010 @ 06:43 AM
I've modify the patch to be applied on
master
-
Prem Sichanugrist (sikachu) January 20th, 2010 @ 06:43 AM
- Tag changed from 3.0, activemodel, activerecord, bugmash, strip_attribtutes to 3.0, activemodel, activerecord, bugmash, bugmash-review, review, strip_attribtutes
-
Prem Sichanugrist (sikachu) January 20th, 2010 @ 09:23 AM
@Josh Sharpe
After I have discuss your addition in #rails-contrib, I can't really find a good use case for this method. So, I think this feature would be nice to be made as a plugin instead. If there're enough user using it, then it can be merged into core later.
Thank you :)
-
Yehuda Katz (wycats) January 20th, 2010 @ 09:26 AM
- State changed from new to invalid
-
Rizwan Reza May 15th, 2010 @ 06:45 PM
- Tag changed from 3.0, activemodel, activerecord, bugmash, bugmash-review, review, strip_attribtutes to 3.0, activemodel, activerecord, bugmash, review, strip_attribtutes
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>