Sha256: 5b884769e3455e42d803e01bf8a55624f1ea409bdfa09d80c874bb378f4a729f
Contents?: true
Size: 943 Bytes
Versions: 9
Compression:
Stored size: 943 Bytes
Contents
module Godmin class EngineWrapper attr_reader :engine def initialize(controller) @engine = find_engine(controller) end def namespace @namespace ||= engine.railtie_namespace end def namespaced? @namespaced ||= namespace.present? end def namespaced_path @namespaced_path ||= begin if namespaced? namespace.name.split("::").map(&:underscore) else [] end end end def root engine.root end private def find_engine(controller) engine_module = find_engine_module(controller) if engine_module "#{engine_module}::Engine".constantize else Rails.application end end def find_engine_module(controller) controller.parents.find do |parent| parent.respond_to?(:use_relative_model_naming?) && parent.use_relative_model_naming? end end end end
Version data entries
9 entries across 9 versions & 1 rubygems