title: constant values in Rails
body: <p>I have some data that I want to store somewhere in my Rails app because I use it for generating form fields, checking a submitted form to ensure its values are valid, etc.  Basically, I want the data in one location because I make use of it in several places.</p>
  
  <p>Previously, I was defining an <code>initialize</code> method in my controller and initializing instance variables within that method, e.g. <code>@graph_types = ['bar', 'line']</code>.  This seemed a bad idea because that's really all <code>initialize</code> was being used for (initializing those values) and the instance variables could be changed later, which I don't want.</p>
  
  <p>Now, I define constants outside of any method in my controller, right up at the top after my filters, and I freeze them, e.g. <code>GraphTypes = ['bar', 'line'].freeze</code>.</p>
  
  <p>I didn't want to store such data in a config file because then I would have to keep track of an extra file, read in the file and parse it, etc.  I didn't want to store this data in the database because that seems like overkill; I don't need to do any crazy LEFT OUTER JOIN-type queries combining available graph types with another of my constants, say <code>Themes = ['Keynote', 'Odeo', '37 Signals', 'Rails Keynote'].freeze</code>.  I didn't want to store the data in environment.rb because this data only pertains to a particular controller.</p>
  
  <p>Considering all this, am I going about this 'the Ruby way'?</p>