My ActiveRecord is not telling the truth. See for yourself:
> User.posts.class
=> Array
> User.posts.all.class
=> Array
> a = Array.new
> a.class
=> Array
> a.all
NoMethodError: undefined method `all' for []:Array
There is no Array#all method, so User.posts can’t be an Array. What is going on here?
this is the way that associations are implemented in rails. they are lazy proxy objects.
have a look at the documentation for further infos on this: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/collection_proxy.rb#L25