# Multiple independent sets of validations with validation\_scopes gem

**URL:** <https://www.ruby-forum.com/t/multiple-independent-sets-of-validations-with-validation-scopes-gem/181116>\
**Category:** Rails\
**Created:** [January 5, 2010, 8:31pm UTC](https://www.ruby-forum.com/t/multiple-independent-sets-of-validations-with-validation-scopes-gem/181116 "2010-01-05T20:31:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasil003](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@dasil003](https://www.ruby-forum.com/u/dasil003)\
**Post date:** [January 5, 2010, 8:31pm UTC](https://www.ruby-forum.com/t/multiple-independent-sets-of-validations-with-validation-scopes-gem/181116/1 "2010-01-05T20:31:03Z")

</div>

Being able to have groups of validations, partial validations, or  
validations that don’t prevent saving an object are common needs w/  
ActiveRecord. Last week I did an exhaustive search of the available  
plugins, and I wasn’t able to find anything that satisfactorily solved  
all the problems. Either things were too verbose, too limiting, too  
specific, or I just didn’t like the API.

Enter validation\_scopes. I wrote this plugin to solve my problems  
while still being able to harness the full power of ActiveRecord  
validation.

[http://github.com/dasil003/validation\_scopes](http://github.com/dasil003/validation_scopes)

If you have interest in such a thing please give it a try. At less  
than 50 lines, I think it’s a sustainable approach that will port well  
to Rails 3, but it’s also very dense meta-programming, so I want to  
get more people using it to shake out bugs around the edge cases.

---

<div class="post-metadata">

**Author:** ![dasil003](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@dasil003](https://www.ruby-forum.com/u/dasil003)\
**Post date:** [January 5, 2010, 9:48pm UTC](https://www.ruby-forum.com/t/multiple-independent-sets-of-validations-with-validation-scopes-gem/181116/2 "2010-01-05T21:48:53Z")

</div>

Just a general question after quickly looking over it, can you create  
new scopes that won’t let you save? or would this be accomplished  
through something like f.save if f.no\_warnings?

Thanks,  
Marli

---

<div class="post-metadata">

**Author:** ![dasil003](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@dasil003](https://www.ruby-forum.com/u/dasil003)\
**Post date:** [January 5, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/multiple-independent-sets-of-validations-with-validation-scopes-gem/181116/3 "2010-01-05T23:26:39Z")

</div>

Sadly no, that wasn’t really in my use case. You might like this one  
thought: [http://github.com/freetwix/validation\_scenarios](http://github.com/freetwix/validation_scenarios)

---

<div class="post-metadata">

**Author:** ![dasil003](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@dasil003](https://www.ruby-forum.com/u/dasil003)\
**Post date:** [January 6, 2010, 4:05am UTC](https://www.ruby-forum.com/t/multiple-independent-sets-of-validations-with-validation-scopes-gem/181116/4 "2010-01-06T04:05:51Z")

</div>

Thanks for the reference, your plugin looks pretty good, I’ll try to  
give you some feedback if I end up using it.

– Marli
