Module: RouteUrlHelpers

Extended by:
ActiveSupport::Concern
Includes:
Rails.application.routes.url_helpers
Included in:
ArticleLinkCheckerWorker, BlogSchemaExtractionWorker, Crm::BasePresenter::Router, ImageGenerationWorker, Models::CatalogItemAmazonHelper, PostComment, ProductSpecification, SearchesHelper, SeoPageAnalysisWorker, UrlHelper, Www::Router
Defined in:
app/concerns/route_url_helpers.rb

Overview

Mixes Rails' route URL helpers (foo_path / foo_url) into plain Ruby
objects — models, workers, presenters — the way controllers and views get
them for free.

Two implementation subtleties:

  • The ROUTES indirection exists for the docs build: a bare
    include Rails.application.routes.url_helpers makes YARD's mixin handler
    warn "Undocumentable mixin" (the argument is a method chain, not a
    constant), once per including class.
  • This MUST stay an ActiveSupport::Concern: the generated url_helpers
    module is itself a concern whose included hooks define
    default_url_options on the includer (via UrlFor). Included through a
    plain module those hooks fire on the module instead, and instances of
    the including class lose default_url_options (NameError on any
    foo_path call).

Constant Summary collapse

ROUTES =

Rails route URL helper module, captured in a constant so YARD's mixin
handler doesn't warn "Undocumentable mixin" on the method chain.

Rails.application.routes.url_helpers