# Problems with select pulldowns combined with has\_many :throu

**URL:** <https://www.ruby-forum.com/t/problems-with-select-pulldowns-combined-with-has-many-throu/69453>\
**Category:** Rails\
**Created:** [September 21, 2006, 5:38am UTC](https://www.ruby-forum.com/t/problems-with-select-pulldowns-combined-with-has-many-throu/69453 "2006-09-21T05:38:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmarkham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@mrmarkham](https://www.ruby-forum.com/u/mrmarkham)\
**Post date:** [September 21, 2006, 5:38am UTC](https://www.ruby-forum.com/t/problems-with-select-pulldowns-combined-with-has-many-throu/69453/1 "2006-09-21T05:38:32Z")

</div>

I’m having problems with the above. For description purposes, let’s  
just assume I have 3 models: User, Movie and Viewings, with the  
following obvious fields:

users - name  
movies - name  
viewings - user\_id, movie\_id

I’m trying to use collection\_select to create the appropriate pulldown,  
but the following isn’t working:

collection\_select(“user”, “viewings.movie\_id”, @movies, “id”, “name”)

When I run it, I’m getting the following:

undefined method `viewings.movie\_id’ for #User:0x23a32b8

What am I missing?

- Andy

---

<div class="post-metadata">

**Author:** ![mrmarkham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@mrmarkham](https://www.ruby-forum.com/u/mrmarkham)\
**Post date:** [September 22, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/problems-with-select-pulldowns-combined-with-has-many-throu/69453/2 "2006-09-22T16:59:37Z")

</div>

mrmarkham wrote:

> collection\_select(“user”, “viewings.movie\_id”, @movies, “id”, “name”)
> 
> When I run it, I’m getting the following:
> 
> undefined method `viewings.movie\_id’ for #User:0x23a32b8
> 
> What am I missing?

At present, such chained method parameters in Active Record form  
helpers won’t work. You have to set @viewings = @user.viewings  
and call collection\_select(:viewings, :movie\_id, @movies, :id, :name)

–  
We develop, watch us RoR, in numbers too big to ignore.
