title: Where should I store a list of select options in Rails 3?
body: <p>Using Rails 3.1.3 and Ruby 1.9.3.</p>
  
  <p>I want to give the user a list of possible date/time formats. The user's selection will be stored in the Users table. Date/time values are then formatted using the I18n.localize function. I actually have 10 formats; here by way of example are the first two:</p>
  
  <p><strong>config/locales/datetime.en.yml</strong></p>
  
  <pre><code>en:
    time:
      format_labels:
        mdyslash12: mm/dd/yyyy - hh:mm am (12-hour)
        mdyslash24: mm/dd/yyyy - hh:mm (24-hour)
      formats:
        mdyslash12: ! '%m/%d/%Y %I:%M%p'
        mdyslash24: ! '%m/%d/%Y %H:%M'
  </code></pre>
  
  <p>My question is where to store the list of possible date/time formats. I've identified three possibilities.</p>
  
  <h3>1. List options as a CONSTANT in model:</h3>
  
  <p><strong>app/models/user.rb</strong></p>
  
  <pre><code>DATETIME_FORMATS = %w[mdyslash12 mdyslash24]
  validates :datetime_format, :presence =&gt; true,
            :inclusion =&gt; { :in =&gt; DATETIME_FORMATS }
  </code></pre>
  
  <h3>2. Create an application constant and validate against that:</h3>
  
  <p><strong>config/initializers/constants.rb</strong></p>
  
  <pre><code>Rails.configuration.datetime_formats = "mdyslash12 mdyslash24"
  </code></pre>
  
  <p><strong>app/models/user.rb</strong></p>
  
  <pre><code>validates :datetime_format, :presence =&gt; true,
            :inclusion =&gt; { :in =&gt; Rails.application.config.datetime_formats.split(" ") }
  </code></pre>
  
  <h3>3. Validate directly against the locale file:</h3>
  
  <p><strong>app/models/user.rb</strong></p>
  
  <pre><code>validates :datetime_format, :presence =&gt; true,
            :inclusion =&gt; { :in =&gt; (I18n.t 'time.format_labels').stringify_keys.keys }
  </code></pre>
  
  <p>This option uses a feature that is new to me:  <code>I18n.t 'time.format_labels'</code> returns a hash of ALL keys and values from that branch of the locale file.  The hash keys are symbols, so to get a string array, I call <code>stringify_keys</code> to convert the symbols to strings, then <code>keys</code> to give me only the keys (no values).</p>
  
  <p>Option #3 is the DRYest in that I don't have to list the possible values in two places. But it doesn't feel quite right to depend on the locale file for the discreet list of possible date/time formats.</p>
  
  <p>What would you recommend? One of these options? Something else?</p>