Created
November 27, 2009 01:44
-
-
Save lsegal/243771 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 Post | |
include ODB::Persistent | |
attr_accessor :title, :author | |
def __serialize_key__; title.to_sym end | |
end | |
db = ODB.new | |
post = nil | |
db.transaction do | |
post = Post.new.tap {|p| p.title = "x"; p.author = "Joe" } | |
end | |
db.store[:x] == post # => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment