lib/surrounded/railtie.rb in surrounded-rails-0.2.0 vs lib/surrounded/railtie.rb in surrounded-rails-0.2.1

- old
+ new

@@ -1,11 +1,19 @@ require "surrounded/rails/version" require "surrounded" require "rails" module Surrounded class Railtie < ::Rails::Railtie - initializer 'surrounded.active_record' do |app| - ActiveRecord::Base.send(:include, Surrounded) + if defined?(ActiveRecord) + initializer 'surrounded.active_record' do |app| + ActiveRecord::Base.send(:include, Surrounded) + end + end + + if defined?(Mongoid) + initializer 'surrounded.mongoid' do |app| + Mongoid::Document.send(:include, Surrounded) + end end initializer 'surrounded.action_controller' do |app| ActionController::Base.send(:include, Surrounded) end