Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Latest commit

 

History

History
32 lines (22 loc) · 463 Bytes

README.rdoc

File metadata and controls

32 lines (22 loc) · 463 Bytes

README

DataMapper::Observer allows you to add callback hooks to many models. This is similar to observers in ActiveRecord.

Example:

class Adam

include DataMapper::Resource

property :id, Serial
property :name, String

end

class AdamObserver

include DataMapper::Observer

observe Adam

before :save do
  # log message
end

before :get_drunk do
  # eat something
end

after_class_method :unite do
  raise "Call for help!"
end

end