tanya
tanya

Reputation: 2985

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.

Upvotes: 1

Views: 112

Answers (3)

Yardboy
Yardboy

Reputation: 2805

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.

Upvotes: 1

user483040
user483040

Reputation:

On my installation the sql statements are dumped into the development log (or the output of 'rails server'...

Upvotes: 1

mhoofman
mhoofman

Reputation: 654

The test log will show all database queries performed

tail -f log/test.log

Upvotes: 1

Related Questions