Sha256: c53055d25386d697822d95f46cd277e458541d7427b8fbc86d672e59a3f5be45

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'rails/railtie'

module ActiveModel
  class Railtie < Rails::Railtie
    generators do |app|
      Rails::Generators.configure! app.config.generators
      require 'generators/resource_override'
    end
  end
end

module Draper
  class Railtie < Rails::Railtie

    config.after_initialize do |app|
      app.config.paths.add 'app/decorators', eager_load: true
    end

    initializer "draper.setup_action_controller" do |app|
      ActiveSupport.on_load :action_controller do
        Draper.setup_action_controller self
      end
    end

    initializer "draper.setup_action_mailer" do |app|
      ActiveSupport.on_load :action_mailer do
        Draper.setup_action_mailer self
      end
    end

    initializer "draper.setup_active_record" do |app|
      ActiveSupport.on_load :active_record do
        Draper.setup_active_record self
      end
    end

    console do
      require 'action_controller/test_case'
      ApplicationController.new.view_context
      Draper::ViewContext.build_view_context
    end

    rake_tasks do
      Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
draper-1.0.0.beta2 lib/draper/railtie.rb
draper-1.0.0.beta1 lib/draper/railtie.rb