title: Default value of enum if it's not present
body: <p>I have a enum in a model. I want to get its integer value, or it's not set I want to get an integer value of a value which I choose to be a default one:</p>
  
  <pre><code>  enum my_enum: [:val1, :val2, :val3]
  
    def method1
      int_val = self.read_attribute(:my_enum)
  
      # what if my_enum hasn't been set?
      unless int_val
        int_val = ??? # how to get integer of :val2 ???
      end
    end
  </code></pre>