Module: EngineHelper::ClassMethods

Included in:
RailsDynamicErrors::Engine
Defined in:
lib/engine_helper.rb

Instance Method Summary collapse

Instance Method Details

#mounted_atString

Identifies the absolute path (i.e. ‘/’ prefixed) at which an engine is mounted within its parent Rails application.

Returns:

  • (String)

    the mount path, or nil if not mounted



8
9
10
11
12
13
# File 'lib/engine_helper.rb', line 8

def mounted_at
  route = Rails.application.routes.routes.detect do |route|
    route.app == self
  end
  route && route.path.spec.to_s
end