RailsのLogでのパラメータをFILTEREDする。
Railsでpasswordパラメータはデフォルトで見えなくなってますね。
Started POST "/users" for ::1 at 2015-06-29 14:16:14 +0900
Processing by UsersController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ZrB1VEJ6B0nd7GxJ/BkxybIpF2jAyqhT6DjCx6YOuOXyK6kRBn75IPeN1RO/DHhEvJ1VyA96H6XHg8Cfsb6Jww==", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}, "commit"=>"submit"}
ここにemailもLogに見せたくない場合。
config/initializers/filter_parameter_logging.rb
Rails.application.config.filter_parameters += [:password]
↓
# emailも付与する
Rails.application.config.filter_parameters += [:password, :email]
こうすると、↓になる。
Started POST "/users" for ::1 at 2015-06-29 14:18:34 +0900
Processing by UsersController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ZrB1VEJ6B0nd7GxJ/BkxybIpF2jAyqhT6DjCx6YOuOXyK6kRBn75IPeN1RO/DHhEvJ1VyA96H6XHg8Cfsb6Jww==", "user"=>{"email"=>"[FILTERED]", "password"=>"[FILTERED]"}, "commit"=>"submit"}
Author And Source
この問題について(RailsのLogでのパラメータをFILTEREDする。), 我々は、より多くの情報をここで見つけました https://qiita.com/ShotaKameyama/items/149f07dc6ce202c3f57a著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .