spec/test_classes.rb in super_sti-0.2.1 vs spec/test_classes.rb in super_sti-0.3.0
- old
+ new
@@ -1,12 +1,19 @@
class Account < ActiveRecord::Base
- before_create :set_initial_balance
+ before_create :set_defaults
+ scope :approved, where(:is_approved => true)
+
private
- def set_initial_balance
- self.balance = 0
+ def set_defaults
+ self.balance = 0 unless balance
+ self.is_approved = 0 unless is_approved
true
end
+end
+
+class BasicAccount < Account
+ has_extra_data
end
class BankAccount < Account
has_extra_data do
belongs_to :bank
\ No newline at end of file