Sha256: 096bfc26906844c8b471f2e49c2d02c1c89c26b6827b3c6740a1586c2e22b7f4
Contents?: true
Size: 1.01 KB
Versions: 43
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module EacRailsBase0 module Patches module UrlForPatch class << self def included(base) base.prepend(InstanceMethods) end end module InstanceMethods def url_for(options = nil) super(options) rescue ActionController::UrlGenerationError engines_url_for(options) end private def engines_url_for(options) ::Rails::Engine.subclasses.each do |engine| url = engine_url_for(engine, options) return url if url end raise ActionController::UrlGenerationError, "Options: #{options}" end def engine_url_for(engine, options) engine.routes.url_for(options) rescue ActionController::UrlGenerationError nil end end end end end patch = ::EacRailsBase0::Patches::UrlForPatch target = ::ActionDispatch::Routing::UrlFor target.prepend(patch) unless target.included_modules.include?(patch)
Version data entries
43 entries across 43 versions & 1 rubygems