2

I'm filtering passwords in my Rails 3.1 app's config/application.rb file as usual with:

config.filter_parameters += [:password]

However, I'm got an email field in two different models, and I'd like to filter email from only one of those models. Is there a way to do this?

GarlicFries
  • 8,095
  • 5
  • 36
  • 53
  • take a look at this http://stackoverflow.com/questions/7615805/custom-filtering-of-parameters-in-rails-3-using-config-filter-parameters – Mikhail Nikalyukin Nov 03 '11 at 11:23
  • 1
    Actually, the entire params hash is 'flattened' before passing it to a the `filter_params` lambda, so a these params, `{ "model_1[email]" => "address_1", "model_2[email]" => "address_2" }`, essentially end up looking like this inside the lambda: `{ "email" => "address_1", "email" => "address_2" }`. – GarlicFries Nov 03 '11 at 13:29

0 Answers0