Defaults, on-site-text, other static data in rails

Rails theory question:

What is the best way to store “static” values? I.e., the default
preferences for new users, or strings found throughout a site (all text
displayed to the end user is in a DB so that languages are easy to add).

Currently this stuff is in the DB, default preferences being a “special”
user (id: -1), and site text is in a big ole’ db table of its own.

This seems like it might be a bad solution and it definitely leads to 2
problems:

First: Its slow. Every time any page loads all the text being pulled
out of a db is way too slow, as I’m making the app I’m currently working
on mostly to learn my way around rails, and its only in use by ~20
people this is no problem, but it seems not scalable.

Second: I do not know the “right way” to bring this data to a new place
when the server changes (which it does not too infrequently since its
internal). I have a giant migration file full of data to add to these
tables, but there’s gotta be a better way right?

Theory: It seems like the right solution to the first problem here
might just be to make rails pull this “static” information out of the DB
and into an object or a yaml file when it starts, is that correct? Is
that possible? Is there a way easy and way railsy way to do it?

The second problem also seems like it has an easy solution, there must
be a simple way to migrate and rebuild the data that is not
user-specific when hopping moving a rails app, what is the correct way
to do that? I.e. all the text displayed to the end user, I currently
just move that whole table as sql, but that seems awfully non-rails.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs