title: How to store and compare :symbols in an ActiveRecord (Ruby on Rails)
body: <p>I thought it would be good to populate a status field in an activeRecord table using constants. However, when it comes to checking if this status has a particular status, I'm having trouble. </p>
  
  <p>If I do the following, </p>
  
  <pre><code>e = Mytable.new
  e.status = :cancelled
  e.save
  </code></pre>
  
  <p>then refind the record and try and compare my status to the symbol, the check fails. I have some output from the console to show this. </p>
  
  <pre><code>irb(main):060:0&gt; e.status.eql?("cancelled")
  =&gt; true
  irb(main):061:0&gt; e.status.eql?(:cancelled)
  =&gt; false
  irb(main):062:0&gt; e.status == :cancelled
  =&gt; false
  irb(main):063:0&gt; e.status == "cancelled"
  =&gt; true
  irb(main):064:0&gt; e.status == :cancelled.to_s
  =&gt; true
  </code></pre>
  
  <p>Is there a better way of holding a status in a record? Is there a way of testing if a current field value is equal to the :symbol without converting the :symbol to a string? I'm thinking there may be an operator I'm not aware of. </p>