开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜