sam / dm-more
- Source
- Commits
- Network (46)
- Issues (0)
- Downloads (11)
- Wiki (1)
- Graphs
-
Tree:
47b8a82
Dan Kubb (author)
Tue Jun 24 08:55:58 -0700 2008
commit 47b8a82b187f95dfb4702ebd0b99903fcf2daf44
tree ea62155c04ac75f2762f0fc35017e816d7a5d72c
parent e602a514b011d7d510950414b45ce5b9309c4012
tree ea62155c04ac75f2762f0fc35017e816d7a5d72c
parent e602a514b011d7d510950414b45ce5b9309c4012
dm-more / dm-shorthand
dm-shorthand/README
dm-shorthand
============
DataMapper plugin providing shortcut usage of models in multiple repositories.
When using this plugin, every time you define a new model M, a method with the same
name as the model is defined inside the module where you defined M.
=Example
Let's say you have repositories :default, :one and :two.
class MyModel
include DataMapper::Resource
property :a, String
property :b, String
end
This will allow you to operate on those repositories like this:
# create a new instance of MyModel in repository :one
MyModel(:one).create(:a => "a's value!", :b => "b's value!")
# fetch the MyModel instance with id == 1 from repository :two
MyModel(:two)[1]
# instantiate a new MyModel instance with its default repository
# set to :default
m = MyModel.new

