Sha256: 81133681466573dd427104faef5990a31e6811bfb1f8e281bdad54dc72e2e523

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

require 'rails/engine'

module Gemgento
  class Engine < Rails::Engine
    isolate_namespace Gemgento
    engine_name 'gemgento'

    config.autoload_paths += %W(#{config.root}/lib)

    # load decorators
    config.to_prepare do
      Dir.glob(Rails.root + 'app/decorators/**/*_decorator*.rb').each do |c|
        require_dependency(c)
      end
    end

    initializer :gemgento do

      # Include application specific Active Admin resources
      ActiveAdmin.application.load_paths << File.dirname(__FILE__) + '/admin'

      # allow custom queries to sanitize inputs
      class ActiveRecord::Base
        def self.escape_sql(clause, *rest)
          self.send(:sanitize_sql_array, rest.empty? ? clause : ([clause] + rest))
        end
      end

    end

    # filter logging of sensitive fields
    initializer 'gemgento.params.filter' do |app|
      app.config.filter_parameters += [
          :cc_owner,
          :cc_number,
          :cc_cid,
          :cc_exp_month,
          :cc_exp_year
      ]
    end

    config.generators do |g|
      g.test_framework      :rspec,        fixture: false
      g.fixture_replacement :factory_girl, dir: 'spec/factories'
      g.assets false
      g.helper false
    end

    config.active_job.queue_adapter = :sidekiq

    # Append migrations direction to Application
    initializer :append_migrations do |app|
      unless app.root.to_s.match 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

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 lib/gemgento/engine.rb