Hi.
I write
<%= Chat.find_by(id: 6).chatusers.each { |chat_user| chat_user.user.inspect 
} %>

(There are three models: Chat, Chatuser, User)

Chat.find_by(id: 6).chatusers returns collection of table "chats_users" and 
this is fine working.
But i can not get model user by each element of collection in method "each".
So, question is why each not working to get relative model "user" or how to 
resolve my task by each or another way.

Thanks.


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/39772b1a-1b11-49c5-8eb3-c7a34a5ece3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to