Sha256: a9dd797e0d0837426a3cfd8918716b94c7781c3a5143b1da52af0edb5db32422

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 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

    ##
    # Decorators are loaded in
    # => at app boot in non-development environments
    # => after each request in the development environment
    #
    # This is necessary because we might never explicitly reference
    # Decorator constants.
    #
    config.to_prepare do
      ::Draper::System.load_app_local_decorators
    end

    ##
    # The `app/decorators` path is eager loaded
    #
    # This is the standard "Rails Way" to add paths from which constants
    # can be loaded.
    #
    config.before_initialize do |app|
      app.config.paths.add 'app/decorators', :eager_load => true
    end

    initializer "draper.extend_action_controller_base" do |app|
      ActiveSupport.on_load(:action_controller) do
        Draper::System.setup(:action_controller)
      end
    end

    initializer "draper.extend_action_mailer_base" do |app|
      ActiveSupport.on_load(:action_mailer) do
        Draper::System.setup(:action_mailer)
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
draper-0.13.0 lib/draper/railtie.rb
draper-0.12.1 lib/draper/railtie.rb
draper-0.12.0 lib/draper/railtie.rb