Sha256: 744a05c2d45a166dd1e9741c0d243ef3cd7174ed7a44d98bb7a63cebffabbbb6

Contents?: true

Size: 1.53 KB

Versions: 8

Compression:

Stored size: 1.53 KB

Contents

require 'polygallery'
require 'polygallery/controller_helpers'
require 'polygallery/model_helpers'
require 'polygallery/view_helpers'
require 'polygallery/simple_form_helper'
require 'polygallery/glue'

module Polygallery
  class Engine < ::Rails::Engine
    isolate_namespace Polygallery

    initializer 'polygallery.assets' do
      Rails.application.config.assets.precompile +=
        %w( polygallery/thumbnail-missing.jpg )
    end
    initializer 'polygallery_engine.action_controller' do |app|
      ActiveSupport.on_load :action_controller do
        ActionController::Base.send :include, ControllerHelpers
      end
    end
    initializer 'polygallery.model_helpers' do
      ActiveSupport.on_load :active_record do
        ActiveRecord::Base.send :include, ModelHelpers
        ActiveRecord::Base.send :include, Polygallery::Glue
      end
    end
    initializer "polygallery.view_helpers" do
      ActiveSupport.on_load :action_view do
        ActionView::Base.send :include, ViewHelpers
        if defined? SimpleForm
          ActionView::Base.send :include, SimpleFormHelper
          SimpleForm::FormBuilder.send :define_method, 'simple_fields_for_polygallery' do |*args, &block|
            template.simple_fields_for_polygallery self, *args, &block
          end
        end
      end
    end
    initializer :append_migrations do |app|
      unless app.root.to_s == root.to_s
        config.paths['db/migrate'].expanded.each do |expanded_path|
          app.config.paths['db/migrate'] << expanded_path
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
polygallery-0.4.8 lib/polygallery/engine.rb
polygallery-0.4.7 lib/polygallery/engine.rb
polygallery-0.4.6 lib/polygallery/engine.rb
polygallery-0.4.5 lib/polygallery/engine.rb
polygallery-0.4.4 lib/polygallery/engine.rb
polygallery-0.4.2 lib/polygallery/engine.rb
polygallery-0.4.1 lib/polygallery/engine.rb
polygallery-0.4.0 lib/polygallery/engine.rb