Skip to content

Instantly share code, notes, and snippets.

@ramhoj
Created February 3, 2010 12:12
Show Gist options
  • Save ramhoj/293564 to your computer and use it in GitHub Desktop.
Save ramhoj/293564 to your computer and use it in GitHub Desktop.
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
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
im_saved im_created im_saved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment