I'm using Rails 3.2.0
Let's say I have:
class Comment < ActiveRecord::Base
has_many :articles
end
c1 = Comment.last
then
c1.articles.class
# => Array
c1.articles.where('id NOT IN (999999)').class
# => ActiveRecord::Relation
Why is the result of an association not a type of ActiveRecord::Relation
?
It clearly is / was at some point:
c1.articles.to_orig
# undefined method `to_orig' for #<ActiveRecord::Relation:0x007fd820cc80a8>
c1.articles.class
# => Array
Certain evaluations act upon an ActiveRecord::Relation object, but inspecting the class gives a different type.
Particularly, this breaks building lazy-loaded queries when using merge
to concat multiple queries.