Sha256: 25ae4b9d669245bca8321017c923f534671965954789620eef0be044d7304d8d

Contents?: true

Size: 912 Bytes

Versions: 6

Compression:

Stored size: 912 Bytes

Contents

module EffectiveQbSync
  class Engine < ::Rails::Engine
    engine_name 'effective_qb_sync'

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

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

    # Include acts_as_addressable concern and allow any ActiveRecord object to call it
    initializer 'effective_qb_sync.active_record' do |app|
      Rails.application.config.to_prepare do
        ActiveSupport.on_load :active_record do
          Effective::OrderItem.class_eval do
            has_one :qb_order_item

            # first or build
            def qb_item_name
              (qb_order_item || build_qb_order_item(name: purchasable.qb_item_name)).name
            end
          end
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
effective_qb_sync-1.2.5 lib/effective_qb_sync/engine.rb
effective_qb_sync-1.2.4 lib/effective_qb_sync/engine.rb
effective_qb_sync-1.2.3 lib/effective_qb_sync/engine.rb
effective_qb_sync-1.2.2 lib/effective_qb_sync/engine.rb
effective_qb_sync-1.2.1 lib/effective_qb_sync/engine.rb
effective_qb_sync-1.2.0 lib/effective_qb_sync/engine.rb