Sha256: a9f5ac26768fc1360d36eab73daa95fc03dc08e80705d3f732e17fbd05e6244f

Contents?: true

Size: 938 Bytes

Versions: 5

Compression:

Stored size: 938 Bytes

Contents

require 'rails'
require 'uploader'

module Uploader
  # Usage (config/routes.rb):
  #
  #   Rails.application.routes.draw do
  #     mount Uploader::Engine => '/uploader'
  #   end
  #
  class Engine < ::Rails::Engine
    isolate_namespace Uploader

    initializer 'uploader.assets_precompile' do |app|
      app.config.assets.precompile += Uploader.assets
    end

    initializer 'uploader.helpers' do
      ActiveSupport.on_load :action_view do
        ActionView::Base.send(:include, Uploader::Helpers::FormTagHelper)
        ActionView::Helpers::FormBuilder.send(:include, Uploader::Helpers::FormBuilder)
      end
    end

    initializer 'uploader.hooks' do
      require 'uploader/hooks/active_record' if Object.const_defined?('ActiveRecord')
      require 'uploader/hooks/simple_form'   if Object.const_defined?('SimpleForm')
      require 'uploader/hooks/formtastic'    if Object.const_defined?('Formtastic')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-uploader-0.3.4 lib/uploader/engine.rb
rails-uploader-0.3.3 lib/uploader/engine.rb
rails-uploader-0.3.2 lib/uploader/engine.rb
rails-uploader-0.3.1 lib/uploader/engine.rb
rails-uploader-0.3.0 lib/uploader/engine.rb