title: Best practice for converting integer value column to string representation
body: <p>Lets say you have a model like the following:</p>
  
  <pre><code>class Stock &lt; ActiveRecord::Base
    # Positions
    BUY = 1
    SELL = 2
  end
  </code></pre>
  
  <p>And in that class as an attribute of type integer called 'position' that can hold any of the above values. What is the Rails best practice for converting those integer values into human readable strings? </p>
  
  <p>a) Use a helper method, but then you're force to make sure that you keep the helper method and model in sync</p>
  
  <pre><code>def stock_position_to_s(position)
    case position
    when Stock::BUY
      'buy'
    when Stock::SELL
      'sell'
    end
    ''
  end
  </code></pre>
  
  <p>b) Create a method in the model, which sort of breaks a clean MVC approach.</p>
  
  <pre><code>class Stock &lt; ActiveRecord::Base
    def position_as_string
      ...snip
    end
  end
  </code></pre>
  
  <p>c) A newer way using the new I18N stuff in Rails 2.2? </p>
  
  <p>Just curious what other people are doing when they have an integer column in the database that needs to be output as a user friendly string. </p>
  
  <p>Thanks,
  Kenny</p>