On 4 September 2015 at 14:46, Николай Спелый <peavey515...@gmail.com> wrote: > 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.
What error are you getting (copy/paste it from the log please)? Also copy/paste the section of chat_user.rb showing the associations. Colin -- 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/CAL%3D0gLsBpeQWg2rJFU0niJApkRW5Q%2B4bROCB%3D%3DtVQ%2BrYwF8dDA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.