Sometimes the options of an ActiveRecord enum don't make sense outside the context of the enum's name.
class User < ApplicationRecord
enum authentication_strategy: [:disabled, :password, :captcha]
end
Calling
@user.password? would not make much sense.
Of course we could prefix this so that it instead reads
@user.authentication_strategy_password?.
This still reads a bit oddly to me.
Using ActiveSupport's StringInquirer, we could instead do:
@user.authentication_strategy.password?.
To me, this approach makes it most clear that
*password? refers specifically to the concept of
authentication_strategy.