Reputation: 5950
Is there a way debug ActiveRecord queries before they are executed rather than after?
Upvotes: 2
Views: 2163
Reputation: 4027
You can call .to_sql on the end of the query to output the sql that it generates like so:
SomeModel.where(:stuff => 'is here').to_sql
Upvotes: 12