Imagine you have some code as follows:
class User < ApplicationRecord
PUBLIC_FIELDS = %i(foo bar baz).freeze
scope :public_fooed, -> { select(PUBLIC_FIELDS).where(foo: true) }
def publicize
slice(*PUBLIC_FIELDS)
end
end
It slightly annoys me that to filter attributes at the model class level (while doing a `::select`), you don't need to splat `PUBLIC_FIELDS`, but you do when doing it at the model object level (with `#slice`).
We could safely flatten the arguments to `#slice` to remove the need to splat since ActiveRecord::Core#slice will never have attributes (or methods) that are arrays. This would bring it in line with `::select`
Thoughts?