Hi Matt,

Thanks for your input. Actually I made it working without using STI. Not 
sure this is the right way of doing it. But, this is what I wanted.

class TransactionItem < ActiveRecord::Base
  validates :note, length: { in: 2..255 }
  validates :transaction_date, presence: true
end

class Expense < TransactionItem
  belongs_to :expense_type, :class_name => "TransactionType", 
:foreign_key => "transaction_type_id"
  validates :expense_type, presence: true
end

class Income < TransactionItem
  belongs_to :income_type, :class_name => "TransactionType", 
:foreign_key => "transaction_type_id"
  validates :income_type, presence: true
end

Let me know your thoughts.

Thanks.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/03ed22b0aff4f5a09b6f1a100e6f972f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to