I have found in several resources online than when doing stuff like:
cars = Car.where(:colour => \'black\')
The query is not executed, until
I ran a test using sqllite3 to attempt to find out if the AR Base find actually did a query immediately. Here is what I did:
rows=Customer.orders.find(1,2)
Then I did:
ActiveRecord::Base.remove_connection;
p rows
I got a connection not established error.
I also tried "p rows" immediately after the query w/o removing the connection and got the 2 rows I expected.
This was done with activerecord-3.1.3. My conclusion is that in 3.1.3 base find waits to do the query until the array (Relation?) is accessed.
I'm new at Ruby so my test might not be designed correctly.