ActiveRecord :has_many associations and === operator

Posted by Jakub on Stack Overflow See other posts from Stack Overflow or by Jakub
Published on 2010-06-15T20:47:24Z Indexed on 2010/06/15 20:52 UTC
Read the original article Hit count: 160

Can someone explain me this Ruby on Rails puzzle?

 class Post < ActiveRecord::Base
   has_many :comments
 end

 Post.first.comments.class
 => Array

 Array === Post.first.comments
 => false

 Array === [ 1 ]
 => true

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby