spec/dummy/dummy.rb in amfetamine-0.2.12 vs spec/dummy/dummy.rb in amfetamine-0.3.0
- old
+ new
@@ -1,32 +1,20 @@
class Dummy < Amfetamine::Base
- @@children = [] # unrelated to relationships!
-
amfetamine_attributes :title, :description
validates_presence_of :title, :description
has_many_resources :children
+ has_many_resources :students, foreign_key: 'parent_id'
before_create :action_before_create
after_create :action_after_create
before_save :action_before_save
after_save :action_after_save
before_validation :action_before_validate
-
- # Needed for proper ID tracking
- def initialize(args={})
- @@children << self
- super(args)
- end
-
- def self.children
- @@children ||= []
- end
-
def action_before_create
Amfetamine.logger.warn "Yo, BEFORE CREATE called"
end
def action_after_create
@@ -39,7 +27,6 @@
def action_after_save
end
def action_before_validate
end
-
end