0
0

More than 3 years have passed since last update.

【rails】ストロングパラメータの仕組みを理解しよう

Posted at

ストロングパラメータとは?

フォームから入力された情報を指定して、安全に受け取るための仕組み。これによって不正な情報を受け取らないことができる。

コントローラー
def tweet_params
  params.permit(:title, :text)
end

ここで使っているpermitはparamsで取得したキーのうち、データベースに保存していいものを許可するメソッドです。

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