Если у меня есть такие модели:
class Transaction < ActiveRecord
# create table called transactions and add type column to it.
# add common methods inside this class
end
class CashTransaction < Transaction
# the type column will be CashTransaction and used to determine entry for this class in transactions table
end
class CreditCardTransaction < Transaction
validates :settled, :presence => true
# the type column will be CreditCardTransaction and used to determine entry for this class in transactions table
end
Как я могу применить проверку, уникальную для CreditCardTransaction? Таким образом, Transaction и CashTransaction родительского класса не нуждаются в проверке того, была ли транзакция урегулирована?