Polymorphic STI

For fun, I wanted to write a wallet application. There must be
tranasctions with came in to flavors - income and spendings. After
playing for a while, i wanted to make everything pretty.

I have something like:

class FinancialTransction < AR::Base
belongs_to :transactinable, :polymorphic => true
end

class Income < AR::Base
end

class Spending < AR::Base
end

Then i though - why should i have almost empty models just for the
sake of saving id. I tried this and that, but nothing works. It’s
either empty transactionable_type or two separate records (first
without type, second with).

My question: how to implement this? is there some beautiful way?

Assuming that you want STI:

create_table :financial_transactions do |t|
t.string :transaction_type

end

class FinancialTransaction < AR:Base
self.inheritance_column :transaction_type

end

class Income < FinancialTransaction

end

class Spending < FinancialTransaction

end