News for hackers. Stuff that matters.
Re:Literate SQL by vinceguidry on Sunday June 25, 2017 @10:43AM (#14630212)
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.
Re:Literate SQL by meditationapp on Sunday June 25, 2017 @02:13PM (#14631328)
Of course, not all operations return a relation, such as count, update_all, delete, etc, even if they have a sql equivalent.