title: roles based authetication using enum
body: <p>Am building a rails app where i want to have two types of users i.e sellers and buyers. Users can choose at the time of signup weather they want to signup as seller or buyer.</p>
  
  <p>I created users using devise then
   added   <code>enum role: [:seller, :buyer]</code> in <code>user.rb</code></p>
  
  <p>then created a migration to add roles to user</p>
  
  <pre><code>rails g migration add_role_to_users
  </code></pre>
  
  <p>my migration looks like this:</p>
  
  <pre><code>class AddRoleToUsers &lt; ActiveRecord::Migration
     def change
        add_column :users, :role, :integer
     end
  end
  </code></pre>
  
  <p>I am using simple form, in my <code>users registration form</code> i added</p>
  
  <pre><code>&lt;%= f.select :role, User.roles %&gt;
  </code></pre>
  
  <p>On the index page i am trying to do this:</p>
  
  <pre><code>&lt;% if current_user.seller? %&gt;
    &lt;%= link_to 'New Post', new_post_path %&gt;
    &lt;% else %&gt;
    hello
  &lt;% end %&gt;
  </code></pre>
  
  <p>but somehow roles of my users is returning as nil, i have checked the console also and even there the roles of my user return as nil, can someone please help me and tell me what am doing wrong. Thanking you</p>