title: Ruby on rails - 2 users types
body: <p>I am writing ruby on rails application, which will have 2 different users types (let's say sellers and buyers). I am using devise gem to handle authentication.</p>
  
  <p>I don't want to use single table inheritance for 3 reasons:<br>
  1) I don't want to have a lot of columns in my user table (I would have to store fields for both seller and buyer in one table, and they will have a lot of different fileds)<br>
  2) I don't want to have a lot of null values in my database<br>
  3) Keeping sellers and buyers separated will help to improve performance speed</p>
  
  <p>I decided to create 2 separate models for sellers and buyers (and generate devise for each of them). Long story short - it caused some troubles (ie. difficulties with handling login with single form, using polymorphic associations for simple things like "private message", keeping my code DRY etc.)</p>
  
  <p><b>So here is the question:</b><br>
  Do You think it would be good idea to create one model (user) with some common fields to easily handle authentication with devise and then have separate models (sellers and buyers) with belongs_to and has_one associations to store more info. Something like this:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_one :seller
    has_one :buyer
  end
  
  class Seller &lt; ActiveRecord::Base
    belongs_to :user, :conditions =&gt; "user_type= 'seller'"
  end
  
  class Buyer &lt; ActiveRecord::Base
    belongs_to :user, :conditions =&gt; "user_type= 'buyer'"
  end
  </code></pre>
  
  <p>Is that a good solution? Or do You think single table inheritance would be a better idea?<br><br>
  What troubles / difficulties it may cause?<br>
  What will be routes for displaying profile page for each user? I would like to have something like <em>website.com/sellers/id</em> and  <em>website.com/buyers/id</em><br></p>
  
  <p>If You can think of better solution for my problem - please let me know.</p>