I'm working on a project which requires talking to two different databases: a MySQL one for persistent data and an experimental in-memory database for real-time data.
It would make my life a bit easier if there was a way to access and use the SQL Query generated by the ActiveRecord finders.
I know there have been other questions along these lines but the answers they had seemed to suggest logging the SQL to STDOUT and were not for Rails 3
Model.all executes the query and you are trying to call to_sql on an Array.
Do this
Model.scoped.to_sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With