Guest User

Untitled

a guest
May 22nd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. q1 = Question.find(2323, :include => :responses)
  2.  
  3. puts q1.responses[1].inspect #=> #<Response id: 33871, created_at: "2008-02-29 19:05:24", question_id: 2323, user_id: 7>
  4. puts q1.responses[1].user_id #=> nil
  5.  
  6. puts q1.responses.collect { |response| response.user_id }
  7. # => output: for some reason the collect statement shows user_id for every response to be nil even though I know most of them are not!
  8. nil
  9. nil
  10. nil
  11. nil
  12. nil
  13. nil
  14. nil
  15. nil
  16. nil
  17. nil
  18. ...
Add Comment
Please, Sign In to add comment