Module: Rails::Engine::LazyRouteSet::MountedHelpers
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::ActiveSupport::Concern
|
|
|
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
::ActionDispatch::Routing::RouteSet::MountedHelpers - Included
::ActionDispatch::Routing::UrlFor - Included
Instance Method Summary
- #method_missing(method_name) private
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean private
::ActionDispatch::Routing::UrlFor - Included
| #initialize, | |
| #route_for | Allows calling direct or regular named route. |
| #url_for | Generate a URL based on the options provided, |
| #url_options | Hook overridden in controller to add request information with |
| #_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)
# 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