2017-07-18から1日間の記事一覧
背景 ams = AwesomeModel.where(id: [1,2,3]) #=> <ActiveRecord::Relations ... > で、ams は AwesomeModel のインスタンスであるが、インスタンス化したくないときがある。 どうするか AwesomeModel.connection.exec_query(AwesomeModel.where(id: [1,2,3]).to_sql).to_hash #=> [{id: 1,</activerecord::relations>…