Ruby on Rails テーブルの全レコードを取得する
Modelのallメソッドを使えばテーブルの全レコードを含む配列オブジェクトを取得できます。
class HogesController < ApplicationController
def index
@hoges = Hoge.all
end
end
実行環境
Rails 2.3.5
Rails 2.3.5
前の記事 « Emacs リージョンのハイライト表示