Created
May 8, 2009 03:22
-
-
Save snusnu/108595 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'rubygems' | |
gem 'dm-core', '=0.9.11' | |
gem 'dm-validations', '=0.9.11' | |
gem 'dm-is-remixable', '=0.9.11' | |
gem 'dm-is-cloneable', '=0.0.1' | |
require 'dm-core' | |
require 'dm-validations' | |
require 'dm-is-remixable' | |
require 'dm-is-cloneable' | |
DataMapper::Logger.new(STDOUT, :debug) | |
DataMapper.setup(:default, 'sqlite3:memory:') | |
class Item | |
include DataMapper::Resource | |
property :id, Serial | |
property :master_item_id, Integer # add this property if backlinks are desired | |
property :name, String | |
property :description, String | |
is :cloneable | |
# adds the following api to this class | |
# | |
# # attributes_to_clone can be one of | |
# # <:all|String|Array[String|Symbol]|ItemCloneSpec> | |
# Item#clone_resource(nr_of_clones, attributes_to_clone = :all) | |
# Item#master_resource | |
# Item#cloned_resources | |
# Item#has_backlinks_to_master? | |
# Item#has_clone_specs? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment