Skip to content

Commit

Permalink
Allow url_for to override current_resource (#2567)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Aug 31, 2022
1 parent 90518bc commit 9112378
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ def asset_url(path, prefix='', options={})
# Given a source path (referenced either absolutely or relatively)
# or a Resource, this will produce the nice URL configured for that
# path, respecting :relative_links, directory indexes, etc.
#
# Relative routes will be relative the the current_resource. Pass the
# `:current_resource` option to customize.
def url_for(path_or_resource, options={})
options_with_resource = {}.merge!(options).merge!(current_resource: current_resource)
options_with_resource = {}.merge!(current_resource: current_resource).merge!(options)
::Middleman::Util.url_for(app, path_or_resource, options_with_resource)
end

Expand Down

0 comments on commit 9112378

Please sign in to comment.