## Models
class Account < ActiveRecord::Base
has_many :users, :as => :account, :dependent => :destroy
end

class Buyer < Account
set_table_name :buyers
end

class Seller < Account
set_table_name :sellers
end

class User < ActiveRecord::Base
belongs_to :account, :polymorphic => true
end


## Tables (minimal fields for testing)
create_table :users do |t|
t.references :account, :polymorphic => true
t.string :name
end

create_table :buyers do |t|
t.string :company
end

create_table :sellers do |t|
t.string :organization
end

## Console:
Loading development environment (Rails 2.0.2)
>> b = Buyer.create(:company => "FooCo")
=> #<Buyer id: 1, company: "FooCo">
>> b.users << User.new(:name => "Joe User")
=> [#<User id: 1, account_id: 1, account_type: "Buyer", name: "Joe User">]
>> s = Seller.create(:organization => "BarOrg")
=> #<Seller id: 1, organization: "BarOrg">
>> s.users << User.new(:name => "Sam OtherUser")
=> [#<User id: 2, account_id: 1, account_type: "Seller", name: "Sam OtherUser">]
>> User.find(:first).account
=> #<Buyer id: 1, company: "FooCo">
>> User.find(:first).account.users
=> [#<User id: 1, account_id: 1, account_type: "Buyer", name: "Joe User">]
>> User.find(:first).account.class
=> Buyer(id: integer, company: string)
>>