Provides a single point of entry for popular ruby ORMs. Its target audience is gem authors who want to support more than one ORM.
Currently supported ORMs are ActiveRecord, DataMapper and MongoId.
require 'orm_adapter' User # is it an ActiveRecord, DM Resource, or MongoId Document? User.to_adapter.find_first :name => 'Fred' # we don't care! user_model = User.to_adapter user_model.get!(1) # find a record by id user_model.find_first(:name => 'fred') # find first fred user_model.find_all(:name => 'fred') # find all freds user_model.create!(:name => 'fred') # create a fred
orm_adapter is an extraction from pickle by Ian White. Pickle's orm adapter included work by Daniel Neighman and Josh Bassett. José Valim suggested the extraction, and worked on the first release with Ian.
Copyright © 2010 Ian White and José Valim. See LICENSE for details.