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
Something like this?
exclude_columns = ['password', 'email']
columns = User.attribute_names.delete_if(|x| exclude_columns.include?(x))
User.select(columns)
EDIT
I forgot that we can do Array1 - Array2
A best answer:
exclude_columns = ['password', 'email']
columns = User.attribute_names - exclude_columns
User.select(columns)