# Password filtering does not work

**URL:** <https://discuss.rubyonrails.org/t/password-filtering-does-not-work/69544>\
**Category:** rubyonrails-talk\
**Created:** [September 2, 2014, 12:26pm UTC](https://discuss.rubyonrails.org/t/password-filtering-does-not-work/69544 "2014-09-02T12:26:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [September 2, 2014, 12:26pm UTC](https://discuss.rubyonrails.org/t/password-filtering-does-not-work/69544/1 "2014-09-02T12:26:58Z")

</div>

In my Rails 4 application, when I have a form including a password, i.e.

&nbsp;&nbsp;&nbsp;\<%= password\_field\_tag 'admpwd', nil, size:32, maxlength: 32, class: 'admentry' %\>

I don't like the fact that the password is shown plain text in the log file, and would like to disable this. I found several suggestions to place the call

&nbsp;&nbsp;&nbsp;filter\_parameter\_logging "password"

into application.rb, but when I do it, I get the error message

&nbsp;&nbsp;&nbsp;undefined method `filter\_parameter\_logging' for Tamsin::Application:Class

How can I do this correctly?

---

<div class="post-metadata">

**Author:** ![hassan](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/hassan/32/714_2.png) [@hassan](https://discuss.rubyonrails.org/u/hassan)\
**Post date:** [September 2, 2014, 2:33pm UTC](https://discuss.rubyonrails.org/t/password-filtering-does-not-work/69544/2 "2014-09-02T14:33:43Z")

</div>

Hint: look at your initializers.

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [September 3, 2014, 9:20am UTC](https://discuss.rubyonrails.org/t/password-filtering-does-not-work/69544/3 "2014-09-03T09:20:01Z")

</div>

Hassan Schroeder wrote in post #1156593:

> > In my Rails 4 application, when I have a form including a password, i.e.
> 
> > I don't like the fact that the password is shown plain text in the log file, and would like to disable this.
> 
> > How can I do this correctly?
> 
> Hint: look at your initializers.

Thanks, that was it!

Just for the record:

The default content of

&nbsp;&nbsp;&nbsp;config/initializers/filter\_parameter\_logging.rb

(which was probably generated automatically with my rails application) is

&nbsp;&nbsp;&nbsp;Rails.application.config.filter\_parameters += [:password]

Since my password field is named differently, I had to add it to this list:

&nbsp;&nbsp;&nbsp;Rails.application.config.filter\_parameters += [:password,:admpwd]
