2017-07-24 16:20:53 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2010-08-02 11:38:44 -04:00
|
|
|
module AbstractController
|
2010-07-30 01:14:48 -04:00
|
|
|
module Railties
|
|
|
|
module RoutesHelpers
|
2014-06-19 18:26:29 -04:00
|
|
|
def self.with(routes, include_path_helpers = true)
|
2010-08-02 10:04:39 -04:00
|
|
|
Module.new do
|
|
|
|
define_method(:inherited) do |klass|
|
|
|
|
super(klass)
|
2018-10-04 20:58:29 -04:00
|
|
|
if namespace = klass.module_parents.detect { |m| m.respond_to?(:railtie_routes_url_helpers) }
|
2018-10-03 17:15:47 -04:00
|
|
|
klass.include(namespace.railtie_routes_url_helpers(include_path_helpers))
|
|
|
|
else
|
|
|
|
klass.include(routes.url_helpers(include_path_helpers))
|
|
|
|
end
|
2010-08-02 10:04:39 -04:00
|
|
|
end
|
2010-07-30 01:14:48 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|