LoginSignup
0
1

More than 3 years have passed since last update.

【Rails】Strong Promoters

Last updated at Posted at 2020-03-07

Strong Promoters

コントローラファイルに記載するセキュリティを強固にする仕組み
name, email,password,password_confirmationの4つのカラムがある時

params.require(:user).permit(:name, :email, :password, :password_confirmation)

上記のよう記載することで4つのカラムがparamsハッシュに対して受け取りを許可し、
他は無効にすることができる。

詳しく説明すると、
image.png

上記のような画面フォームがあった時に画面内の4項目以外はデータを受け取らないようにすることができる。
これをしないと、ID情報とかを書き換えられてしまう可能性がある。

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