But if I didn't want to load the User model into an instance is there a way to utilize hstore_accessor to pluck out just the reminders_enabled value? I can currently do something like:
But that is less than ideal because we lose the translation of the string "true" to the value true and I'd rather not hardcode the Postgres "settings->'notifications_enabled'" query.
Say I have a
User
model with an hstore field calledsettings
that contains a boolean callednotifications_enabled
. That allows me to doBut if I didn't want to load the
User
model into an instance is there a way to utilizehstore_accessor
to pluck out just thereminders_enabled
value? I can currently do something like:But that is less than ideal because we lose the translation of the string
"true"
to the valuetrue
and I'd rather not hardcode the Postgres"settings->'notifications_enabled'"
query.Ideally we could do something like: