Forum: Ruby on Rails @collection.each{|item| ...} => item = nil ???

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
joserwan (Guest)
on 2008-10-20 19:40
(Received via mailing list)
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 ?
Craig D. (Guest)
on 2008-10-20 19:54
(Received via mailing list)
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
joserwan (Guest)
on 2008-10-20 20:04
(Received via mailing list)
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>
This topic is locked and can not be replied to.