title: Ruby on Rails: reverse lookup of array list of values
body: <p>i have a model with a user selectable option that is set up in an array on the model.</p>
  
  <pre><code>def Pie &lt; ActiveRecored::Base
      def self.sel_options
        [ [ "Apple Blueberry", "AB" ],
          [ "Cranberry Date", "CD" ] ]
      end
  end
  </code></pre>
  
  <p>while the short string is retrieved from elsewhere and stored in the database, i would like to display the longer string when showing the object.  e.g. in the view use:</p>
  
  <pre><code>Pie.display_customeor_choice[@pie_flavor]
  </code></pre>
  
  <p>i don't want to hard code the reverse hash, but if i create a display_options method that converts the array to a hash with reverse mapping will it run the conversion every time display_options is called?  this could be resource intensive with large arrays that are converted a lot, is there a way to create the reverse hash once when the app is started and never again?  (using rails 3 and ruby 1.9.2)</p>