Sha256: 900afe242f7d168dffa433c27b01f50e26fe7accd6ab43264c4ccee193253b93

Contents?: true

Size: 1.84 KB

Versions: 34

Compression:

Stored size: 1.84 KB

Contents

module EffectiveOrders
  class Engine < ::Rails::Engine
    engine_name 'effective_orders'

    config.autoload_paths += Dir["#{config.root}/app/models/**/"]

    # Include Helpers to base application
    initializer 'effective_orders.action_controller' do |app|
      ActiveSupport.on_load :action_controller do
        helper EffectiveOrdersHelper
        helper EffectiveCartsHelper
        helper EffectivePaypalHelper if EffectiveOrders.paypal_enabled
        helper EffectiveStripeHelper if EffectiveOrders.stripe_enabled
      end
    end

    # Include acts_as_addressable concern and allow any ActiveRecord object to call it
    initializer 'effective_orders.active_record' do |app|
      ActiveSupport.on_load :active_record do
        ActiveRecord::Base.extend(ActsAsPurchasable::ActiveRecord)
      end
    end

    initializer 'effective_orders.action_view' do |app|
      ActiveSupport.on_load :action_view do
        ActionView::Helpers::FormBuilder.send(:include, Inputs::PriceFormInput)
      end
    end

    # Set up our default configuration options.
    initializer "effective_orders.defaults", :before => :load_config_initializers do |app|
      eval File.read("#{config.root}/lib/generators/templates/effective_orders.rb")
    end

    # Set up our Stripe API Key
    initializer "effective_orders.stripe_api_key", :after => :load_config_initializers do |app|
      if EffectiveOrders.stripe_enabled
        require 'stripe'
        ::Stripe.api_key = EffectiveOrders.stripe[:secret_key]
      end
    end

    # ActiveAdmin (optional)
    # This prepends the load path so someone can override the assets.rb if they want.
    initializer 'effective_orders.active_admin' do
      if defined?(ActiveAdmin) && EffectiveOrders.use_active_admin == true
        ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
      end
    end

  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
effective_orders-1.4.1 lib/effective_orders/engine.rb
effective_orders-1.4.0 lib/effective_orders/engine.rb
effective_orders-1.3.13 lib/effective_orders/engine.rb
effective_orders-1.3.12 lib/effective_orders/engine.rb
effective_orders-1.3.11 lib/effective_orders/engine.rb
effective_orders-1.3.10 lib/effective_orders/engine.rb
effective_orders-1.3.9 lib/effective_orders/engine.rb
effective_orders-1.3.8 lib/effective_orders/engine.rb
effective_orders-1.3.7 lib/effective_orders/engine.rb
effective_orders-1.3.6 lib/effective_orders/engine.rb
effective_orders-1.3.5 lib/effective_orders/engine.rb
effective_orders-1.3.4 lib/effective_orders/engine.rb
effective_orders-1.3.3 lib/effective_orders/engine.rb
effective_orders-1.3.2 lib/effective_orders/engine.rb
effective_orders-1.3.1 lib/effective_orders/engine.rb
effective_orders-1.3.0 lib/effective_orders/engine.rb
effective_orders-1.2.13 lib/effective_orders/engine.rb
effective_orders-1.2.12 lib/effective_orders/engine.rb
effective_orders-1.2.11 lib/effective_orders/engine.rb
effective_orders-1.2.10 lib/effective_orders/engine.rb