# NoMethodError with :has\_many

**URL:** <https://www.ruby-forum.com/t/nomethoderror-with-has-many/108328>\
**Category:** Rails\
**Created:** [July 2, 2007, 11:42am UTC](https://www.ruby-forum.com/t/nomethoderror-with-has-many/108328 "2007-07-02T11:42:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bernd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bernd](https://www.ruby-forum.com/u/bernd)\
**Post date:** [July 2, 2007, 11:42am UTC](https://www.ruby-forum.com/t/nomethoderror-with-has-many/108328/1 "2007-07-02T11:42:10Z")

</div>

Hi,  
I have a problem in the guts of Rails. I have a :has\_many association.  
The :has\_many method calls the method  
“add\_multiple\_associated\_save\_callbacks” and this is where I have  
problems. In the line “validate method\_name” my application crashes with  
a NoMethodError. What is the “validate” method? From which module does  
it come?  
Best regards  
Bernd

---

<div class="post-metadata">

**Author:** ![bernd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bernd](https://www.ruby-forum.com/u/bernd)\
**Post date:** [July 2, 2007, 6:11pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-has-many/108328/2 "2007-07-02T18:11:23Z")

</div>

Moises D. wrote:

> > I have a problem in the guts of Rails. I have a :has\_many association.  
> > The :has\_many method calls the method  
> > “add\_multiple\_associated\_save\_callbacks” and this is where I have  
> > problems. In the line “validate method\_name” my application crashes with  
> > a NoMethodError. What is the “validate” method? From which module does  
> > it come?
> 
> Can you post the code?

The problem is that I have a class that inherits already from another  
class and anyway I want to use some functions of some modules of the  
ActiveRecord package in that class, e.g. from ActiveRecord::Associations  
and  
ActiveRecord::Associations::ClassMethods. So I call has\_many :things and  
then it crashes in line 979 of the file associations.rb of the  
ActiveRecord library. The line has the content “validate method\_name”.

Cheers  
Bernd

---

<div class="post-metadata">

**Author:** ![bernd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bernd](https://www.ruby-forum.com/u/bernd)\
**Post date:** [July 2, 2007, 2:27pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-has-many/108328/3 "2007-07-02T14:27:35Z")

</div>

> I have a problem in the guts of Rails. I have a :has\_many association.  
> The :has\_many method calls the method  
> “add\_multiple\_associated\_save\_callbacks” and this is where I have  
> problems. In the line “validate method\_name” my application crashes with  
> a NoMethodError. What is the “validate” method? From which module does  
> it come?

Can you post the code?
