Ruby Tea with Sugar Rails

How to use find_by_sql without Model

many cases, we use model to use find_by_sql like ModelName.find_by_sql, but now how we can find_by_sql without mode?

ActiveRecord::Base.connection.execute 'select * from users'

To return array of hashes, you can use it :

ActiveRecord::Base.connection.select_all

.


0 comments: