Created
February 3, 2010 12:12
-
-
Save ramhoj/293564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Intervention | |
include Mongoid::Document | |
belongs_to :drug_therapy_problem, :inverse_of => :interventions | |
after_update :im_updated | |
after_create :im_created | |
after_save :im_saved | |
private | |
def im_updated | |
puts "im_updated" | |
end | |
def im_created | |
puts "im_created" | |
end | |
def im_saved | |
puts "im_saved" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should call update, create and save hooks" do | |
@patient = Patient.make(:full) | |
@dtp = @patient.drug_therapy_problems.first | |
intervention = @dtp.interventions.create(Intervention.make.attributes) | |
intervention.save! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
im_saved im_created im_saved |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment