# Has many through: Users, Reservations, and the zen of being totally confused

**URL:** <https://www.ruby-forum.com/t/has-many-through-users-reservations-and-the-zen-of-being-totally-confused/128972>\
**Category:** Rails\
**Created:** [February 13, 2008, 3:41am UTC](https://www.ruby-forum.com/t/has-many-through-users-reservations-and-the-zen-of-being-totally-confused/128972 "2008-02-13T03:41:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MESSYKILL5000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@MESSYKILL5000](https://www.ruby-forum.com/u/MESSYKILL5000)\
**Post date:** [February 13, 2008, 3:41am UTC](https://www.ruby-forum.com/t/has-many-through-users-reservations-and-the-zen-of-being-totally-confused/128972/1 "2008-02-13T03:41:26Z")

</div>

Hey folks,  
This is a question about my rails app. It takes online reservations  
for a hotel. I’ve got a has many through relationship all set up and  
working:

class User \< ActiveRecord::Base  
has\_many :reservations  
has\_many :events, :through =\> :reservations  
end

class Event \< ActiveRecord::Base  
has\_many :users, :through =\> :reservations  
end

class Reservation \< ActiveRecord::Base  
belongs\_to :user  
belongs\_to :event  
end

My confusion comes when I try to actually manipulate this data. In the  
view, how do I show what users are linked to an event? How do I put a  
list of users in the event/show? Am I drunk enough to be this  
confused?! Can some brave soul shed light on this hairy-est of  
queries?

Mahalos.

---

<div class="post-metadata">

**Author:** ![MESSYKILL5000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@MESSYKILL5000](https://www.ruby-forum.com/u/MESSYKILL5000)\
**Post date:** [February 13, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/has-many-through-users-reservations-and-the-zen-of-being-totally-confused/128972/2 "2008-02-13T15:54:19Z")

</div>

On 2/12/08, MESSYKILL5000 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> view, how do I show what users are linked to an event? How do I put a  
> list of users in the event/show? Am I drunk enough to be this  
> confused?! Can some brave soul shed light on this hairy-est of  
> queries?

Well,

if event is an Event, then

event.users is the collection of its Users

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)
