This project is archived and is in readonly mode.
Replacing ActiveRecord::Validations with Validatable
Reported by Jon Wood | June 12th, 2008 @ 12:07 PM | in 3.0.2
I would like to replace ActiveRecord::Validations with the Validatable gem, since this would allow more flexibility in design of models - sepcifically that models which do not extend ActiveRecord will be as simple to add validations to as database backed models.
Before I start on this, is there any interest in doing so?
Comments and changes to this ticket
-
Jeremy Kemper June 12th, 2008 @ 05:16 PM
- Milestone cleared.
- State changed from new to open
I like Validatable's OO design. Have you seen the validations extracted into Active Model? We could merge Validatable into it, retaining compatibility, then replace Active Record's implementation with an Active Model dependency.
-
Ruy Asan July 10th, 2008 @ 01:54 AM
- Tag set to activemodel, activerecord, enhancement
I'm working on a branch which rewrites ActiveModel::Validations in a similar style to Validatable.
-
humbertop September 2nd, 2008 @ 01:15 PM
Hello, I'm getting familiar with Validatable. I want to change all the ActiveRecord Validations in my applications to Valdatable. But I have a question, since ActiveRecord also handles associations how can use Validatable and keep working the models relationships.
-
DHH September 12th, 2008 @ 08:32 PM
- Milestone set to 2.x
-
Daniel Schierbeck November 8th, 2008 @ 09:54 PM
Having an easy way to validate non-ActiveRecord objects would be awesome. The current hack I'm using is ugly as hell.
Using a third party library seems to make sense, as this is a common problem in a lot of Ruby code, and having a single place to put stuff is preferable -- ActiveRecord and ActiveModel could just extend the library with e.g.
validates_association
. -
rjspotter December 3rd, 2008 @ 11:49 AM
My ActiveModel implimentation can be found (https://github.com/rjspotter/rai..., "on github"). It works well enough for my purposes so far. I'm looking for others to give it a go and tell me if I'm smoking crack.
-
Emilio Tagua December 10th, 2008 @ 07:30 PM
Hey guys,
My ActiveModel implementation is here: http://github.com/miloops/rails/...
I took out the tests of ActiveRecord, including i18n tests, of each validation and all tests are passing right now in ActiveModel.
At the moment 9 of 10 validations are working, all except uniqueness since is the most AR dependent by implementation.
Of course this is still experimental but in AR there are 102 tests, 109 assertions in validations and 126 tests, 732 assertions in i18n validations. My ActiveModel implementation is running and passing 117 tests with 602 assertions of those tests.
If anyone interested in what i'm doing please let me know.
-
Jeremy Kemper December 10th, 2008 @ 07:51 PM
Wow, three implementations! Sounds like miloops' is the most compatible and complete so far. Perhaps you guys could collaborate on this?
-
August Lilleaas December 11th, 2008 @ 01:26 PM
Here's my take on an ActiveModel implementation: http://github.com/leethal/active...
It is very lightweight. The validations part is pretty much done. It will break ActiveRecord miserably, of course. I think ActiveRecord itself should handle all the naughty backwards compability, so that ActiveModel itself can stay lean and clean.
I'll be working on making the AR tests pass with my code in the coming weeks.
-
Pratik March 8th, 2009 @ 05:27 PM
- Assigned user set to Pratik
- State changed from open to new
- Milestone cleared.
We can/should push this once 2.3 is out. Meanwhile, maybe you guys could have your branches upto date and collaborate too :)
-
Pratik May 18th, 2009 @ 10:11 PM
- Assigned user changed from Pratik to josh
- State changed from new to incomplete
-
josh August 19th, 2009 @ 03:48 PM
- Assigned user cleared.
-
Pratik August 19th, 2009 @ 03:49 PM
- State changed from incomplete to wontfix
Please reopen if there's any progress.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to
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>
People watching this ticket
Referenced by
- 3058 [PATCH] Sexy Validations I know the idea's pretty much accepted already but I just...