LoginSignup
0
0

More than 1 year has passed since last update.

備忘録:requireメソッドの使い方(二次元ハッシュの場合)

Last updated at Posted at 2022-01-02

form_forで送られたparamsをデータベースへ保存する方法

①requireメソッドを使います。

②paramsの中身を確認して、以下のような二次元ハッシュになっている事を確認する。

{ review{ }  }

③前述の②のような二次元ハッシュ構造のときは以下の雛形で入力した情報を取り出す。

params.require(:モデル名).permit(:カラム名)

引用元:https://chkc.hatenablog.com/entry/2019/07/26/171616

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