# How (and where) is implemented validation errors in forms

**URL:** <https://www.ruby-forum.com/t/how-and-where-is-implemented-validation-errors-in-forms/173491>\
**Category:** Rails\
**Created:** [August 10, 2009, 2:20pm UTC](https://www.ruby-forum.com/t/how-and-where-is-implemented-validation-errors-in-forms/173491 "2009-08-10T14:20:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![itkin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/22d042/32.png) [@itkin](https://www.ruby-forum.com/u/itkin)\
**Post date:** [August 10, 2009, 2:20pm UTC](https://www.ruby-forum.com/t/how-and-where-is-implemented-validation-errors-in-forms/173491/1 "2009-08-10T14:20:57Z")

</div>

Hello everybody !

I’m building up an application which export ads to partners;

So I’ve a hbtm association between the 2 models ad and partner; on the  
view side, the ad form contains several checkboxes (one per partner).

Well the validation of an ad depends on which partner is linked to it.

So i’d like to associate the validation error to each checkbox tag (to  
cirle them in red in the form, when ad validation doesn’t pass).

Do you know when, (in which file?, how?) errors are handled when a form  
is build ?

I can’t get information by myself when i need to understand rails  
“inside” mechanisms, if one of you can provide me some links which  
describe how rails is built, it would be really nice !!

Thanks

Nico

---

<div class="post-metadata">

**Author:** ![itkin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/22d042/32.png) [@itkin](https://www.ruby-forum.com/u/itkin)\
**Post date:** [August 10, 2009, 3:22pm UTC](https://www.ruby-forum.com/t/how-and-where-is-implemented-validation-errors-in-forms/173491/2 "2009-08-10T15:22:36Z")

</div>

nico itkin wrote:

> I can’t get information by myself when i need to understand rails  
> “inside” mechanisms, if one of you can provide me some links which  
> describe how rails is built, it would be really nice !!
> 
> Thanks
> 
> Nico

Nico,

This isn’t an “inside” mechanism. You can write your own custom  
validations. Take a look at ActiveRecord::Validations::validate() in  
the rails api or do a google search on rails validations to find tons of  
tutorials on how to do this…

ilan
