ActiveRecord generates SQL in Rails 3

I am working on a project that requires a conversation with two different databases: MySQL for persistent data and an experimental in-memory database for real-time data.

It would make my life easier if there was a way to access and use the SQL query generated with Finder ActiveRecord.


I know there were other questions in this regard, but the answers that they apparently suggested registering SQL with STDOUT and were not for Rails 3

+3
source share
1 answer

Model.allexecutes the request and you are trying to call to_sqlin an array.

Do it

Model.scoped.to_sql
+5
source

Source: https://habr.com/ru/post/1789481/


All Articles