Sha256: dc1593c9ac8da3ad878c7d3c5e3e226899d0bd911a26a961ef45402618ca9bcd

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require "impressionist"
require "rails"

module Impressionist
  class Engine < Rails::Engine
    initializer 'impressionist.model' do |app|
      require "#{root}/app/models/impressionist/impressionable.rb"
      if Impressionist.orm == :active_record && defined? ActiveRecord
        require "impressionist/models/active_record/impression.rb"
        require "impressionist/models/active_record/impressionist/impressionable.rb"
        ActiveRecord::Base.send(:include, Impressionist::Impressionable)
      elsif Impressionist.orm == :mongo_mapper
        require "impressionist/models/mongo_mapper/impression.rb"
        require "impressionist/models/mongo_mapper/impressionist/impressionable.rb"
        MongoMapper::Document.plugin Impressionist::Impressionable
      elsif Impressionist.orm == :mongoid
        require 'impressionist/models/mongoid/impression.rb'
        require 'impressionist/models/mongoid/impressionist/impressionable.rb'
        Mongoid::Document.send(:include, Impressionist::Impressionable)
      end
    end

    initializer 'impressionist.controller' do
      if Impressionist.orm == :mongoid
          require 'impressionist/controllers/mongoid/impressionist_controller.rb'
      end
      ActiveSupport.on_load(:action_controller) do
        include ImpressionistController::InstanceMethods
        extend ImpressionistController::ClassMethods
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
impressionist-1.2.0 lib/impressionist/engine.rb