-
Notifications
You must be signed in to change notification settings - Fork 526
Using other ORMs
Dave Tapley edited this page Jun 29, 2014
·
3 revisions
Draper automatically includes the Decoratable
model (which gives models a decorate
method) into ActiveRecord::Base
and Mongoid::Document
(Mongoid 3.0+). If you are using another ORM, or decorating plain old Ruby objects, then you need to include it manually.
Mongoid 2.x does not provide a load hook for automatic inclusion of the Decoratable
module. You can put the following in an initializer:
# config/initializers/mongoid.rb
Draper.setup_orm Mongoid::Document
For Sequel models, you can put the following in an initializer:
# config/initializers/sequel.rb
class Sequel::Model
include Draper::Decoratable
end