view sql when submit button is clicked
I would like to know whether there is a way of viewing the sql submitted when the 'Submit' button is clicked in a rails 开发者_开发技巧form.
Thanks for any suggestion provided.
Look in the log/development.rb file - you should be able to see the SQL of every request if you are in dev.
If you are in the console, enter this command at the start:
ActiveRecord::Base.logger = Logger.new(STDOUT)
And you the log comments will be output to your screen.
The test log will show all database queries performed
tail -f log/test.log
On my installation the sql statements are dumped into the development log (or the output of 'rails server'...
精彩评论