Rails: validation that spans multiple models, where to put it?

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-05-08T20:20:56Z Indexed on 2010/05/08 20:28 UTC
Read the original article Hit count: 118

Filed under:
|

I have a custom validation method that is exactly the same for two or more models. Where's the best place to put this validation method so that both models can access it and keep things DRY? If the validation fails, I also want to use errors.add_to_base, so wherever this method is put, I should be able to accommodate for that.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord