I had some fields that were sensitive, so I didn’t want the values appearing in the logs. The solution was filtering them. Doing that was easy.
In config/initializers/filter_parameter_logging.rb, and your fields, like so:
Rails.application.config.filter_parameters += [:password, :secret_field]
Now, when I look at the logs, I see this:
After I installed ActiveAdmin gem, everything worked great except I had an issue where the dropdown menus were showing ActiveRecord hashes like this:
Instead of showing a name like the other fields. It seems that the default is to show a field called “name” in the dropdown menus in ActiveAdmin, and if you don’t have such a field it shows the ActiveRecord instead. Changing that was easy, after I found this StackOverflow question.
All you have to do is go into the model and add a method for to_s, like this:
# field name you want to show in the drop down
for me, I put: