Sha256: 6fa57342e684bc33593ea8bfca4455dfc48c2263e4b0a3447c1a2d48ff93f741

Contents?: true

Size: 889 Bytes

Versions: 10

Compression:

Stored size: 889 Bytes

Contents

module Compony
  class Engine < Rails::Engine
    initializer 'compony.configure_eager_load_paths', before: :load_environment_hook, group: :all do
      # Allow app/components/foo/bar.rb to define constants Components::Foo::Bar and make sure components are eager loaded (needed for route generation etc.)
      Rails.application.config.eager_load_paths.delete(Rails.root.join('app', 'components').to_s)
      Rails.application.config.eager_load_paths.unshift(Rails.root.join('app').to_s)

      # Prevent *.rb files in assets and views directories to be loaded
      Rails.autoloaders.main.ignore(Rails.root.join('app', 'assets').to_s)
      Rails.autoloaders.main.ignore(Rails.root.join('app', 'views').to_s)
    end

    initializer 'compony.controller_mixin' do
      ActiveSupport.on_load :action_controller_base do
        include Compony::ControllerMixin
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
compony-0.1.0 lib/compony/engine.rb
compony-0.0.9 lib/compony/engine.rb
compony-0.0.8 lib/compony/engine.rb
compony-0.0.7 lib/compony/engine.rb
compony-0.0.6 lib/compony/engine.rb
compony-0.0.5 lib/compony/engine.rb
compony-0.0.4 lib/compony/engine.rb
compony-0.0.3 lib/compony/engine.rb
compony-0.0.2 lib/compony/engine.rb
compony-0.0.1 lib/compony/engine.rb