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?