开发者

view sql when submit button is clicked

开发者 https://www.devze.com 2023-03-11 15:24 出处:网络
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.

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'...

0

精彩评论

暂无评论...
验证码 换一张
取 消