Ask A Question

Notifications

You’re not receiving notifications from this thread.

Approach/thoughts for longterm settings outside of the database?

sweedledee asked in Rails

Beginner, playing around with Rails 6.0.

I would like to allow the admin of a Rails site to change the site for all anonymous users who come to it:
Settings like
-how many articles per page while using pagination
-color scheme (primary & secondary colors)
-additional navigation links that are static/absolute.
-landing page greeting text and default background image.
-contact email and pre-filled in content in that email link.

I know this can be created and saved in the database, but is it not wasteful of requesting the DB for every page to send request for all examples above, when they will most likely remain the same for long stretches of time, but still allows the admin to update the image once per season, and maybe update the greetings text twice a year, change contact email once per 3 years, etc...
Note: the DB would still be used for the typical, article CRUD's

Is there a built in hash that's a part of the rail framework, not the db, that the views or controllers can access and also be updated by the logged-in admin? If not, would it be possible to add one?

If it's possible, but a bad idea, why? (security hole?)
Is this what writing rails as an api app is more suitable for?

Am I just a beginner who's trying to lookout for wasted resources that in the real world comes down to minimal waste/requests that is fully normal and expected?

Thanks in advance for any learning on why this is bad/smart/dumb/possible/impossible within the Rails framework.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.