I have a site which needs one admin-editable integer. It has no association to any other model or attribute in the database. It’s literally a flat integer, between 1-10,000, that the admin (who is the only user) needs access to edit.
My question relates to database design. Surely the most efficient way to do this isn’t to create its own table, with just one single column and one single row?
In short…one single field, no associations: how should I best roll that?
It depends on how you define “efficient”.
If you define “efficient” as using
then creating a one-row table probably is the most efficient. Something along these lines might work on the database side.
I don’t think rails supports CHECK constraints, so I think you’ll need to pass
ALTER TABLESQL statements in the migration.