This project is archived and is in readonly mode.
validates_non_format_of - the converse of validates_format_of
-
Ryan Garver
I almost want it to be invalidates_format_of
-
Ken Collins
Yes... I like that name better. Too +1
-
Brennan Dunn
Agreed. I wasn't feeling creative enough to come up with a decent method name ;-)
-
Alex MacCaw
+1
-
Pratik
- Assigned user set to Pratik
- State changed from new to incomplete
- Tag set to activerecord, patch, tested
I don't think we need a new validation method here. Could just add a new key to validates_format_of
validates_format_of :permalink, :without => /admin/i -
Elliot Winkler
I think
validates_format_of :permalink, :not => /admin/ireads a bit better. We ended up patching Rails a while back to support this, so I've prepped this into a proper patch, complete with tests, which I've attached. -
CancelProfileIsBroken
- Tag changed from activerecord, patch, tested to activerecord, bugmash, patch, tested
-
Peer Allan
Verified that the patch does not apply to 2-3-stable or master. The patch would have to be manually redone for master due to the refactor to ActiveModel
-
Peer Allan
Updated patch for 2-3-stable
-
Peer Allan
Patch for master with tests, integrated into ActiveModel
-
Rizwan Reza
- Tag changed from activerecord, bugmash, patch, tested to activerecord, bugmash, patch
not reproducible
+1 I really like the feature.
I am having problems implementing this to current master. The file to implement this activerecord/lib/active_model/validations/format.rb.
-
Elliot Winkler
Are all validations in ActiveModel, is that how it works now?
-
Elliot Winkler
Also I believe Peer meant for the first patch to apply to 2-3-stable and the second to apply to master since I'm guessing ActiveModel has been finished out more in master.
-
Peer Allan
That is exactly right, Elliot. The refactor to ActiveModel meant 2 patches, one for 2-3-stable (the first one) and one for master (the second one).
-
Pratik
I don't think this belongs to 2.3. I've applied it to the master using :without option.
Thanks!
-
Repository
- State changed from incomplete to resolved
(from [cccb0e6b9327fb562b72007a012933c9c61a33fa]) Add validates_format_of :without => /regexp/ option [Elliot Winkler, Peer Allan]
[#430 state:resolved]
Example :
validates_format_of :subdomain, :without => /www|admin|mail/Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/cccb0e6b9327fb562b72007a012933...
