title: How to store enum as string to database in rails
body: <p>How do I create a migration in ruby where the default is a string rather than an Integer, I want to store enum into the database, but I do not want to store it as Integer, because then it does not make sense to another application that wants to use the same table. How do I do <code>default: "female"</code> instead of <code>default:0</code></p>
  
  <pre><code>class AddSexToUsers &lt; ActiveRecord::Migration
    def change
      add_column :users, :sex, :integer, default: 0
    end
  end
  class User &lt; ActiveRecord::Base
    enum sex: [:female, :male]
    has_secure_password
  end
  </code></pre>
  
  <p>I</p>