# @collection.each{|item| ...} =\> item = nil?

**URL:** <https://www.ruby-forum.com/t/collection-each-item-item-nil/151357>\
**Category:** Rails\
**Created:** [October 20, 2008, 5:40pm UTC](https://www.ruby-forum.com/t/collection-each-item-item-nil/151357 "2008-10-20T17:40:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joserwan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@joserwan](https://www.ruby-forum.com/u/joserwan)\
**Post date:** [October 20, 2008, 5:40pm UTC](https://www.ruby-forum.com/t/collection-each-item-item-nil/151357/1 "2008-10-20T17:40:38Z")

</div>

Hi,

I really don’t understand :

In a partial, I have a collection “@users”, in wich I included  
“calls” : User.all(:include =\> :calls") in my controller.

So, in the partial, I have something like :

\<% @users.calls.each{|call|%\>  
\<%=h call.from %\>  
\<% } %\>

And the error is that i can’t get nil.from.  
How a this could be nil ?

---

<div class="post-metadata">

**Author:** ![joserwan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@joserwan](https://www.ruby-forum.com/u/joserwan)\
**Post date:** [October 20, 2008, 5:54pm UTC](https://www.ruby-forum.com/t/collection-each-item-item-nil/151357/2 "2008-10-20T17:54:46Z")

</div>

If you rename the call variable in your block to, say, phone\_call, does  
that  
make a difference? I can’t find call on the reserved word list for Ruby  
or  
Rails, but I wonder if it’s just somehow problematic to use it.

Regards,  
Craig

---

<div class="post-metadata">

**Author:** ![joserwan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@joserwan](https://www.ruby-forum.com/u/joserwan)\
**Post date:** [October 20, 2008, 6:04pm UTC](https://www.ruby-forum.com/t/collection-each-item-item-nil/151357/3 "2008-10-20T18:04:47Z")

</div>

No, the problem is out of there…

thank you for the idea !

On Oct 20, 11:53 am, “Craig D.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
