# Raisl 2.2 and has\_many\_trough problems

**URL:** <https://www.ruby-forum.com/t/raisl-2-2-and-has-many-trough-problems/157895>\
**Category:** Rails\
**Created:** [January 16, 2009, 12:35pm UTC](https://www.ruby-forum.com/t/raisl-2-2-and-has-many-trough-problems/157895 "2009-01-16T12:35:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [January 16, 2009, 12:35pm UTC](https://www.ruby-forum.com/t/raisl-2-2-and-has-many-trough-problems/157895/1 "2009-01-16T12:35:03Z")

</div>

Have just installed rails 2.2.2 My application has many has\_many\_trough  
associtions. With rails 2.2.2 I got an error trying to access some of  
them

Event Model  
has\_many :people,:through =\> :participants  
has\_many :participants  
Person Model  
has\_many :events,:through =\> :participants  
has\_many :participants  
Table participants has the fields, event\_id, person\_id, role

Now when I try this test  
@event=Event.find(:first)  
@event.people.each {|person| puts 'EVENT '+person.name}

I got the error stack level too deep (concerns method missing)  
debugging shows that is is the method each that is missing.  
More debugging shows that @event.people seems not to be an array  
When I try puts @event.people I got the error can’t  
convertActiveRecord::Associations::HasManyThroughAssociation into String

I did not have that error in rails 2.0 and it shows up only for some  
has\_many ass  
Anyone that has had the same problem ?  
Any work-arounds ?  
Thanks or any help

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [January 16, 2009, 3:12pm UTC](https://www.ruby-forum.com/t/raisl-2-2-and-has-many-trough-problems/157895/2 "2009-01-16T15:12:19Z")

</div>

On 16 Jan 2009, at 11:35, Hans M. wrote:

> has\_many :events,:through =\> :participants  
> has\_many :participants  
> Table participants has the fields, event\_id, person\_id, role

Do you need to create the :participants association before you create  
associations through it ?

Fred

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [January 16, 2009, 3:24pm UTC](https://www.ruby-forum.com/t/raisl-2-2-and-has-many-trough-problems/157895/3 "2009-01-16T15:24:27Z")

</div>

Frederick C. wrote:

> On 16 Jan 2009, at 11:35, Hans M. wrote:
> 
> > has\_many :events,:through =\> :participants  
> > has\_many :participants  
> > Table participants has the fields, event\_id, person\_id, role
> 
> Do you need to create the :participants association before you create  
> associations through it ?
> 
> Fred

What do you mean with before ?  
However I changed the order to

has\_many :participants  
has\_many :events,:through =\> :participants

And that does not solve the problem

After som more debugging it seems like all my HasManyThroughAssociation  
have the same problem

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [January 16, 2009, 6:08pm UTC](https://www.ruby-forum.com/t/raisl-2-2-and-has-many-trough-problems/157895/4 "2009-01-16T18:08:44Z")

</div>

# Problem solved !!!

I have now made a lot more debugging that showed that the bad code was  
the plugin will paginate. I had an old version and when I updated to the  
last version (for rails 2.2.2) of will paginate everything works fine  
again.

The lesson learned. Always update your plugins when you update rails  
!!!
