public
Rubygem
Description: Extras for DataMapper, including bridges to DataObjects::Migrations and Merb::DataMapper
Homepage: http://datamapper.org
Clone URL: git://github.com/sam/dm-more.git
dm-more / dm-shorthand
name age message
..
file History.txt Fri Jul 18 12:02:56 -0700 2008 Adding hoe to dm-observer, dm-querizer, dm-seri... [Bernerd Schaefer]
file LICENSE Mon Jun 09 07:24:12 -0700 2008 Added dm-shorthand. [david]
file Manifest.txt Fri Jul 18 12:02:56 -0700 2008 Adding hoe to dm-observer, dm-querizer, dm-seri... [Bernerd Schaefer]
file README.txt Fri Jul 18 12:02:56 -0700 2008 Adding hoe to dm-observer, dm-querizer, dm-seri... [Bernerd Schaefer]
file Rakefile Sun Sep 14 11:27:00 -0700 2008 Minor updates to improve ruby 1.9 compatibility... [dkubb]
file TODO Mon Jun 09 07:24:12 -0700 2008 Added dm-shorthand. [david]
directory lib/ Tue Aug 26 15:25:51 -0700 2008 Version Bump to 0.9.6. [bernerdschaefer]
directory spec/ Mon Jun 09 13:31:08 -0700 2008 sake strip [bernerdschaefer]
README.txt
= 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