This should help you get on the right track:

class User
  # the owner relation
  #
  # user.owned_company 
  # =&gt; company
  #
  has_one :owned_company, :class_name =&gt; "Company", :foreign_key =&gt; "owner_id"

  # the project manager relation
  #
  # user.managed_projects 
  # =&gt; [project,...]
  #
  has_many :managed_projects, :class_name =&gt; "Project", :foreign_key =&gt; "project_manager_id"
end

class Company
  # the owner relation
  #
  # company.owner
  # =&gt; user
  #
  belongs_to :owner, :class_name =&gt; "User"
end

class Project
  # the project manager relation
  #
  # company.project_manager 
  # =&gt; user
  #
  belongs_to :project_manager, :class_name =&gt; "User"
end


Rails ActiveRecord relations are very well documented. See the documentation http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html

How to implement Many to many relationship for USERS TABLE in ruby on rails without using any extra table?
I get Ajax error when I click next button. You can test it here. 

I have found out the problem. It is due to the custom module which I have made. 

&lt;!DOCTYPE html&gt;
&lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt;

&lt;?php

/**
 * Implements hook_block_info().
 *
 * This hook declares what blocks are provided by the module.
 */
function custom_module_block_info()
{
    $blocks['tag_cloud'] = array(
        // The name that will appear in the block list.
        'info' =&gt; t('Custom Moudle'),
        // Default setting.
        'cache' =&gt; DRUPAL_CACHE_PER_ROLE
    );
    return $blocks;
}


When I remove the first two line (Doctype and meta). It works fine. But If I remove first two lines. It doesn't work on IE. I had to insert these two statements to get it working on IE. Now If I keep these two lines, it causes Ajax error, and if not It doesn't work on IE.

Can anyone help?
