Sha256: ba2fc9b4b851061fceae119bc0dc710d465fbd7b5aa818c7f97579d2e49a5f46

Contents?: true

Size: 481 Bytes

Versions: 9

Compression:

Stored size: 481 Bytes

Contents

== 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, Integer, :serial => true
  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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dm-observer-0.9.10 README.txt
dm-observer-0.9.4 README.txt
dm-observer-0.9.7 README.txt
dm-observer-0.9.8 README.txt
dm-observer-0.9.3 README.txt
dm-observer-0.9.11 README.txt
dm-observer-0.9.5 README.txt
dm-observer-0.9.6 README.txt
dm-observer-0.9.9 README.txt