“sql = "SELECT * FROM hoge;" results = ActiveRecord::Base.connection.execute(sql) results.to_a(:as => :hash) #=> [{hoge: 1, foo: "abc"}, {hoge: 2, foo: "def"}]”

kent-where-the-light-iskent-where-the-light-is のブックマーク 2016/05/04 01:18

その他

このブックマークにはスターがありません。
最初のスターをつけてみよう!

Active Record 3つのTipsを紹介 [Distinctの実行、結果を配列/Hashで受け取る] - 酒と泪とRubyとRailsと

    Active Record 3つのTipsを紹介 [Distinctの実行、結果を配列/Hashで受け取る] Jan 13th, 2013 Tweet 今回はActive Recordに関する3つのTipsを紹介します。 (1) Active RecordでDistinctを実行して結果を受け取...

    \ コメントが サクサク読める アプリです /

    • App Storeからダウンロード
    • Google Playで手に入れよう