10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/action_dispatch/routing/direct_routes/route_set/named_route_collection.rb', line 10
def add_url_helper(name, defaults, &block)
helper = CustomUrlHelper.new(name, defaults, &block)
path_name = :"#{name}_path"
url_name = :"#{name}_url"
@path_helpers_module.module_eval do
redefine_method(path_name) do |*args|
helper.call(self, args, true)
end
end
@url_helpers_module.module_eval do
redefine_method(url_name) do |*args|
helper.call(self, args, false)
end
end
@path_helpers << path_name
@url_helpers << url_name
self
end
|