Sha256: aee2cb9b5423d775a49190ff5620cb856ef042a74de2e56de7c1cf56bfb24ec0

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module ModelExplorer
  class Engine < ::Rails::Engine
    isolate_namespace ModelExplorer

    config.generators do |generators|
      generators.test_framework :rspec
      generators.assets false
      generators.helper false
    end

    initializer "model_explorer.assets.precompile" do |app|
      app.config.assets.precompile += [
        "model_explorer/application.css",
        "model_explorer/application.js"
      ]
    end

    initializer :i18n_load_path do |app|
      ActiveSupport.on_load(:i18n) do
        engine_i18n_load_path = Dir[Engine.root.join("config/locales/**/model_explorer/**/*.yml").to_s]
        app.config.i18n.load_path = engine_i18n_load_path.concat(app.config.i18n.load_path)
      end
    end

    initializer :scopes do |_app|
      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Base.include ModelExplorer::Scopes
      end
    end

    initializer :eager_load_models do
      Rails.application.config.to_prepare do
        Rails.autoloaders.main.eager_load_dir(Rails.root.join("app/models"))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
model_explorer-0.1.0 lib/model_explorer/engine.rb