I’m building an Active Record query over a few lines:
query = ForumThread.joins(:posts)
query = query.where(:posts => {:some_integer => 123})
No query is executed for results = query. However results = query.all works. What does call .all on the ActiveRecord::Relation do?
When you say
all you are doing is making results equal to the query object.
When you call
You are sending the all method to query (which says get all of the records that match the query) and assigning the result to results.