Sha256: 1c925ed046d6d664005d8ee4e318227129f98fbc901311e6d2c74a42bafdd63f

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

module Plutonium
  module Pkg
    module Base
      extend ActiveSupport::Concern

      included do
        # prevent this package from being added to the view lookup
        # since we need finer control over how views are resolved.
        # view lookup configuration is handled at the controller level
        config.before_configuration do
          # this touches the internals of rails, but I could not find a good way of doing this
          # we get the initializer instance and set the block property to a noop
          # There is no error handling, to ensure we know when it breaks.
          add_view_paths_initializer = Rails.application.initializers.find do |a|
            a.context_class == self && a.name.to_s == "add_view_paths"
          end
          add_view_paths_initializer.instance_variable_set(:@block, ->(app) {})
        end
      end

      def scoped_to_entity?
        raise NotImplementedError, "scoped_to_entity?"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plutonium-0.8.0 lib/plutonium/pkg/base.rb