123456789_123456789_123456789_123456789_123456789_

Module: Rails::Engine::LazyRouteSet::MountedHelpers

Do not use. This module is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: railties/lib/rails/engine/lazy_route_set.rb

Overview

Mounted helpers are only defined when mount runs during the route draw. _path/_url names are left to method_missing_module, which owns them and relies on reload_routes_unless_loaded returning true only to the caller that performed the load.

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Attribute Summary

Instance Method Summary

::ActionDispatch::Routing::UrlFor - Included

#initialize,
#route_for

Allows calling direct or regular named route.

#url_for

Generate a URL based on the options provided, default_url_options, and the routes defined in config/routes.rb.

#url_options

Hook overridden in controller to add request information with default_url_options.

#_routes_context, #_with_routes, #full_url_for

::ActionDispatch::Routing::PolymorphicRoutes - Included

#polymorphic_path

Returns the path component of a URL for the given record.

#polymorphic_url

Constructs a call to a named RESTful route for the given record and returns the resulting URL string.

#polymorphic_mapping, #polymorphic_path_for_action, #polymorphic_url_for_action

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) (private)

[ GitHub ]

  
# File 'railties/lib/rails/engine/lazy_route_set.rb', line 51

def method_missing(method_name, ...)
  if method_name.end_with?("_path", "_url")
    super
  else
    Rails.application&.reload_routes_unless_loaded
    if ActionDispatch::Routing::RouteSet::MountedHelpers.method_defined?(method_name)
      public_send(method_name, ...)
    else
      super
    end
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean (private)

[ GitHub ]

  
# File 'railties/lib/rails/engine/lazy_route_set.rb', line 64

def respond_to_missing?(method_name, include_private = false)
  if method_name.end_with?("_path", "_url")
    super
  else
    Rails.application&.reload_routes_unless_loaded
    ActionDispatch::Routing::RouteSet::MountedHelpers.method_defined?(method_name) || super
  end
end