# Multiple associations in select list not working

**URL:** <https://www.ruby-forum.com/t/multiple-associations-in-select-list-not-working/149998>\
**Category:** Rails\
**Created:** [October 2, 2008, 5:10am UTC](https://www.ruby-forum.com/t/multiple-associations-in-select-list-not-working/149998 "2008-10-02T05:10:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![staypufd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@staypufd](https://www.ruby-forum.com/u/staypufd)\
**Post date:** [October 2, 2008, 5:10am UTC](https://www.ruby-forum.com/t/multiple-associations-in-select-list-not-working/149998/1 "2008-10-02T05:10:58Z")

</div>

I would like to generate a select list from multiple associations. Do  
not know what the problem is. Hope anyone can  
help.

the code below gives me a: “You have a nil object when you didn’t  
expect it!  
The error occurred while evaluating nil.filename”

----------in the controller----------  
@skinType = Furni.find(:all, :include =\>[:imageasset =\> {:skin =\>  
[:skintype, :skinstyle]}]).map {|st| [st.imageasset. filename, st.id] }

------ in the view ------

\<% form\_tag( ‘list’) do %\>  
\<%= select\_tag :skin, options\_for\_select([“View-All”]+@skinType,  
@skintype\_id.to\_i), :onChange =\>  
“location.href='[http://www.furnii.com/skins/list?skintype\_id='+options[selectedIndex].value](http://www.furnii.com/skins/list?skintype_id='+options%5BselectedIndex%5D.value)”  
%\>  
\<% end %\>

---

<div class="post-metadata">

**Author:** ![staypufd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@staypufd](https://www.ruby-forum.com/u/staypufd)\
**Post date:** [October 2, 2008, 10:30am UTC](https://www.ruby-forum.com/t/multiple-associations-in-select-list-not-working/149998/2 "2008-10-02T10:30:17Z")

</div>

On Oct 2, 4:10 am, Sam G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [:skintype, :skinstyle]}]).map {|st| [st.imageasset. filename, st.id] }  
> It’s telling you that there is a Furni whose imageasset is nil.

Fred
