0
0

More than 1 year has passed since last update.

【Rails】ActiveRecordの機能について

Last updated at Posted at 2022-01-06

ActiveRecordの機能について

・RubyのコードをSQLへ変換する機能

・ActiveRecord経由でデータベースから取得したデータを自動的にインスタンス化して返す機能

>id = 1
>book = Book.find(id)  

#findメソッドでデータベースからデータを取得。
#そして返ってきた結果をbookという変数へ代入している。
#このbookに入っているものがBookのインスタンス。

引用元:基礎から学ぶ Ruby on Rails: 1週間の短期間講座!楽しく学ぶRailsの新しい入門書

0
0
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
0
0