# Def validate in a module does not get called

**URL:** <https://www.ruby-forum.com/t/def-validate-in-a-module-does-not-get-called/48048>\
**Category:** Rails\
**Created:** [November 16, 2005, 8:52am UTC](https://www.ruby-forum.com/t/def-validate-in-a-module-does-not-get-called/48048 "2005-11-16T08:52:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![digidigo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@digidigo](https://www.ruby-forum.com/u/digidigo)\
**Post date:** [November 16, 2005, 8:52am UTC](https://www.ruby-forum.com/t/def-validate-in-a-module-does-not-get-called/48048/1 "2005-11-16T08:52:41Z")

</div>

Anyone have ideas on this one:

I have a module that I include in two models. Each of these models do  
the same validation so I tried to put the shared validate method in  
the module. Problem is that this validate never gets called.

Scary thing is that it does get called in my unit tests.

I am on 14.3 recently upgraded from 13.1

Can anyone explain this?

Thanks,

Dave

---

<div class="post-metadata">

**Author:** ![digidigo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@digidigo](https://www.ruby-forum.com/u/digidigo)\
**Post date:** [November 16, 2005, 10:14am UTC](https://www.ruby-forum.com/t/def-validate-in-a-module-does-not-get-called/48048/2 "2005-11-16T10:14:07Z")

</div>

Please send us some code to look at. It is pretty hard to debug it with  
the  
information you gave.

My guess is that you are accessing the validations differently between  
the  
two, subtly. But I would have to see the code to verify.

Warmest regards,  
Nathan.

* * *

Nathaniel S. H. Brown Toll Free 1.877.4.INIMIT  
Inimit Innovations Phone 604.724.6624  
[www.inimit.com](http://www.inimit.com) Fax 604.444.9942

---

<div class="post-metadata">

**Author:** ![digidigo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@digidigo](https://www.ruby-forum.com/u/digidigo)\
**Post date:** [November 18, 2005, 4:21pm UTC](https://www.ruby-forum.com/t/def-validate-in-a-module-does-not-get-called/48048/3 "2005-11-18T16:21:48Z")

</div>

On 11/16/05, Nathaniel S. H. Brown [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Nathaniel S. H. Brown Toll Free 1.877.4.INIMIT
> 
> > Subject: [Rails] def validate in a module does not get called  
> > I am on 14.3 recently upgraded from 13.1
> > 
> > Can anyone explain this?
> > 
> > Thanks,
> > 
> > Dave

Looks like the problem was that the module class was not getting  
reloaded automatically. A restart of WebBrick made it all happy now.

Thanks,

Dave
