thoughtbot / suspenders

A Rails template with our standard defaults.
https://thoughtbot.com
MIT License
4.02k stars 530 forks source link

How do we want to handle inspecting an `ActiveRecord` instance in production? #1238

Open stevepolitodesign opened 1 day ago

stevepolitodesign commented 1 day ago

https://github.com/rails/rails/pull/49765 makes it so

By default, calling inspect on a record will yield a formatted string including just the id.

However, this has lead to confusion, as noted in https://github.com/rails/rails/issues/52728

stevepolitodesign commented 1 day ago

If we find this is not desireable, we can set config.active_record.attributes_for_inspect = :all in production.

stevepolitodesign commented 1 day ago

Noting that this has the benefit of hidding potentionally sensitive or identifiable information, which can be seen as a security improvement.

However, one could always call #attributes to get past this.

emilford commented 1 day ago

If I remember correctly, performance was another driver behind the change. I'm in favor of keeping the default. It's jarring at first when you're used to the prior behavior, but I've come to accept it with time. It's easy enough to use attributes and it's one less deviation from Rails' defaults.

louis-antonopoulos commented 8 hours ago

I support staying with the default in Production. As a helper to those who might be surprised by the new behavior, maybe we could add a commented-out section to production.rb to make it easier for people to override it?

# Enabling this does [...]
# config.active_record.attributes_for_inspect = :all