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)
|
2011-11-23 14:06:45 -05:00
|
|
|
if namespace = klass.parents.detect { |m| m.respond_to?(:railtie_routes_url_helpers) }
|
2015-01-31 23:12:37 -05:00
|
|
|
klass.include(namespace.railtie_routes_url_helpers(include_path_helpers))
|
2010-08-02 10:04:39 -04:00
|
|
|
else
|
2015-01-31 23:12:37 -05:00
|
|
|
klass.include(routes.url_helpers(include_path_helpers))
|
2010-08-02 10:04:39 -04:00
|
|
|
end
|
|
|
|
end
|
2010-07-30 01:14:48 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|