2017-10-01 6 views
1

私のログインはちょうど壊れました。これまではうまくいっていましたが、今は「許容されていないパラメータ」があります。Railsは自動的に設定されたパラメータを受け入れないのはなぜですか?

Started POST "/login" for ::1 at 2017-09-30 20:29:47 +0200 
Processing by SessionsController#create as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"nDc9mpnsSvQSvHqACAgKteUi/ekfofao5sI9fe67iWaKikZul+mkKfRlkHtYiQtP71DrEmEZZtNnwlkXTvlNAg==", "username"=>"bjelline", "password"=>"[FILTERED]", "commit"=>"Log In"} 
Unpermitted parameters: :utf8, :authenticity_token, :commit 

私はこれらのパラメタutf8、authenticity_tokenとcommitを設定しませんでした。だから、私はそれがレールが自動的に何かをしたと仮定します。

なぜRailsは自分自身で設定したパラメータを使用できないのですか?

答えて

2

は、問題を発見:

class ApplicationController < ActionController::Base 
    protect_from_forgery with: :exception # this was missing 

私が誤って "protect_from_forgery" を削除しました。 authenticity_tokenを自動的に設定して確認するためのレールの一部です。

関連する問題