Created
October 26, 2011 18:14
-
-
Save kennystone/1317209 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
require 'data_mapper' | |
class Post | |
include DataMapper::Resource | |
property :id, Serial | |
before :save, :categorize | |
before :update, :categorize | |
before :create, :categorize | |
def categorize | |
puts "W T F" | |
throw :halt | |
end | |
end | |
DataMapper.setup(:default, "sqlite::memory:") | |
DataMapper::Logger.new($stdout, :debug) | |
DataMapper.finalize.auto_migrate! | |
Post.create! | |
Post.create! | |
Post.create! | |
Post.create! | |
Post.create! | |
puts "#{Post.all.map {|a| a.id}.join(' ')} done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment