title: Rails app with multiple user types and how to model database
body: <p>I have started developing apps for Rails for last couple of months but there is always one question bugging me. How should I model my database if I have multiple user types and each of them has their own columns?</p>
  
  <p>Before I had it simple like this:</p>
  
  <pre><code>create_table "users", force: true do |t|
    t.string   "username"
    t.string   "password"
    t.boolean  "admin",           default: false
    t.boolean  "editor",          default: false
    t.boolean  "publisher",       default: false
    t.boolean  "designer",        default: false
  end
  </code></pre>
  
  <p>When I needed something specific to certain user type in my View or Controller, I just checked is the certain column in 'users' table 'true' or 'false'. That was enough as user types didn't have anything which would be specific to them. Now I have to add many new columns which are only meant for certain user types. If I add those columns I will have many 'null' values inside my 'users' table. For example:</p>
  
  <pre><code>create_table "users", force: true do |t|
    t.string   "username"
    t.string   "password"
    t.boolean  "admin_column1"
    t.boolean  "admin_column2"
    t.boolean  "editor_column1"
    t.boolean  "editor_column2"
    t.boolean  "publisher_column1"
    t.boolean  "publisher_column2"
    t.boolean  "designer_column1"
    t.boolean  "designer_column2"
    t.boolean  "admin",           default: false
    t.boolean  "editor",          default: false
    t.boolean  "publisher",       default: false
    t.boolean  "designer",        default: false
  end
  </code></pre>
  
  <p>This means that if I create a user who is 'editor', I will have something like this inside my table:</p>
  
  <pre><code>  "username": editorUsername
    "password": editorPassword
    "admin_column1": null
    "admin_column2": null
    "editor_column1": editorData1
    "editor_column2": editorData2
    "publisher_column1": null
    "publisher_column2": null
    "designer_column1": null
    "designer_column2": null
    "admin": false
    "editor": true
    "publisher": false
    "designer": false
  </code></pre>
  
  <p>So, as you can see I will have a lot of 'null' values in each row. What would be the recommended way to deal with this situation?</p>