Is there a way I can specify to select ALL columns in ActiveRecord except just a few. For example, for a User, I don\'t want to select their password hash or their email. Is
In some cases, particularly when you're considering a default_scope
to exclude certain columns, I would advise against this approach because of a known issue with Rails about count
breaking after a select
clause. This can lead to surprising downstream errors.
In such a case, consider instead breaking your record into two tables, one with the essential data, the other one with the data you only need from time-to-time, then use associations to access the extra data.