public Method

Kernel.use_orm(orm)

Used in Merb.root/dependencies.yml Tells merb which ORM (Object Relational Mapper) you wish to use. Currently merb has plugins to support ActiveRecord, DataMapper, and Sequel.

Example

$ sudo gem install merb_datamapper # or merb_activerecord or merb_sequel
use_orm :datamapper # this line goes in dependencies.yml
$ ruby script/generate model MyModel # will use the appropriate generator for your ORM

Source Code

# File merb/core_ext/kernel.rb, line 99
def use_orm(orm)
  raise "Don't call use_orm more than once" unless 
    Merb::GENERATOR_SCOPE.delete(:merb_default)
  orm = orm.to_sym
  orm_plugin = orm.to_s.match(/^merb_/) ? orm.to_s : "merb_#{orm}" 
  Merb::GENERATOR_SCOPE.unshift(orm) unless
    Merb::GENERATOR_SCOPE.include?(orm)
  Kernel.dependency(orm_plugin)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.