views:

29

answers:

0

Given a particular model, is there a way to see and edit existing validations?

I'm writing a plugin and I need to modify a validation if it exists.

For example:

If I have a User model with validate_uniqueness_of :ssn

This model is using the plugin so I need to modify that validation and add an :if or a :scope, etc.

So basically if the model has: validations_uniqueness_of :ssn

I want to have it end up as: validations_uniqueness_of :ssn, :last_name, :if ...

I can't find much information on this out there. The closest i've come is here: http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/ but it didn't work for me. No :validate exists as an inheritable_attribute

I'm using Rails 2 ( 2.35 specifically ).

Even if I had to delete the current validation and add a new one with everything I need I'd be okay with that.