Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
vinceguidry
· 9y ago · 0 comments
For anybody on Rails, you can call .to_sql on any ActiveRecord::Relation and it will return the exact SQL string that your code is producing. Really handy for troubleshooting, especially for associations.
Comments
[–]
meditationapp
9y ago
Of course, not all operations return a relation, such as count, update_all, delete, etc, even if they have a sql equivalent.