title: Rails question: What's the optimal way to create user customisable UI texts
body: <p>I have a regular rails app with index, show pages, and forms.</p>
  
  <p>I'd like to allow the administrators of the site to customise the default texts across the site without code changes.</p>
  
  <p>For example, the admins should be able to change a page's H1 tag from "User Index" to "Customer Index", or change a form label from "User Name" to "Customer Name".</p>
  
  <p>I was thinking to create a model called <strong>ui_texts</strong> that has two fields:</p>
  
  <ul>
  <li>machine_name: string</li>
  <li>value: string</li>
  </ul>
  
  <p>Then, I would replace the current hard coded texts with a query like:
  <code>Ui_text.where(machine_name:"user_name").value</code></p>
  
  <p>The admins would have a simple CRUD to edit the ui_texts from the admin interface.</p>
  
  <p>The problem with this approach is that a complex form will generate dozens or even hundreds of database queries to populate all the UI texts.</p>
  
  <p>Even if I index by <strong>machine_name</strong>, the extra queries will add considerable time to the page load.</p>
  
  <p>I wonder what is the optimal way to achieve such functionality?</p>