Skip to content
haines edited this page Jan 21, 2013 · 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

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
module Mongoid::Document
  include Draper::Decoratable
end