LoginSignup
12
8

More than 5 years have passed since last update.

rails consoleで生SQLを実行して結果をHashで得る

Posted at

たまにActiveRecord関係なくSQLを実行したいことがあるので。

hash = ActiveRecord::Base.connection.select_all("select * from xxx").to_hash
12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8