Sha256: b6e4ea68d89ab6e6bd41b76a6da3621a23aa6f3fdedd7f4dea2b567be0ca13d3

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module ActiveAdminAssociations
  class Engine < Rails::Engine
    config.aa_associations = ActiveSupport::OrderedOptions.new
    
    initializer "active_admin_associations.load_extensions" do |app|
      ActiveAdmin::BaseController.helper ActiveAdminAssociationsHelper
      ActiveAdmin::ResourceDSL.send(:include, ActiveAdminAssociations::AssociationActions)
      ActiveAdmin::ResourceDSL.send(:include, ActiveAdminAssociations::FormConfigDSL)
      
      unless app.config.aa_associations.destroy_redirect == false
        ActiveAdmin::BaseController.send(:include, ActiveAdminAssociations::RedirectDestroyActions)
      end
      
      unless app.config.aa_associations.autocomplete == false
        ActiveSupport.on_load(:active_record) do
          ActiveRecord::Base.send(:include, ActiveAdminAssociations::Autocompleter)
        end
      
        Formtastic::Helpers::InputHelper.send(:include, Formtastic::TokenInputDefaultForAssociation)
      end
      
      ActiveAdmin.application.register_stylesheet 'active_admin_associations'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aa_associations-0.1.0 lib/active_admin_associations/engine.rb