ruby on rails - Translate Model.each to an SQL statement -
how translate order active record displays @vehicles.each |vehicle|
sql select
statement?
i noticed @vehicles.each |vehicle|
displays results in particular order, not same order select * vehicles
how find order is?
you can see executed sql query printing @vehicles.to_sql
or looking @ log file. each
enumeration method not add order statements itself.
also, note select * vehicles
not imply particular order. can different same query.
Comments
Post a Comment