Tip : Checking SQL generated by Active Record queries
Posted in Uncategorized on July 13th, 2009 by ph-lee – Be the first to commentThose coming from PHP background or oher languages and have not had experience with object-relational mapping may at first not seem confident with the concept, still prefering to write raw SQL rather than using the tools available.
One tip I can give is to check the SQL queries that Active Record has generated and submitted to the databse. This can be done by viewing the console where the server was started (ie the command line where ruby script/server was executed). All SQL submitted to the database are displayed here when running in development mode. You can also check the logs in log/development.log, here all the text from the script/server console are stored for debugging purposes.
Hope this helps users become more confident in using Active Record rather than writing the SQL by hand.