# Relative\_url\_root in Engines::RailsExtensions::AssetHelpers.plugin\_asset\_path

**URL:** <https://www.ruby-forum.com/t/relative-url-root-in-engines-assethelpers-plugin-asset-path/173576>\
**Category:** Engines Development\
**Created:** [August 11, 2009, 5:09pm UTC](https://www.ruby-forum.com/t/relative-url-root-in-engines-assethelpers-plugin-asset-path/173576 "2009-08-11T17:09:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Koleszar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@John\_Koleszar](https://www.ruby-forum.com/u/John_Koleszar)\
**Post date:** [August 11, 2009, 5:09pm UTC](https://www.ruby-forum.com/t/relative-url-root-in-engines-assethelpers-plugin-asset-path/173576/1 "2009-08-11T17:09:40Z")

</div>

Hi,

I have a rails app (redmine) running within a sub-uri via the following  
directive in environment.rb:

ActionController::AbstractRequest.relative\_url\_root = “/redmine”

Unfortunately, URLs generated for plugin assets by Engines do not honor  
this directive. I don’t know Rails, but it seems like an easy fix if you  
know how to get at the request object from within Engines. I was  
thinking of something along these lines:

===================================================================  
— vendor/plugins/engines/lib/engines/rails\_extensions/asset\_helpers.rb  
(revision 2796)  
+++ vendor/plugins/engines/lib/engines/rails\_extensions/asset\_helpers.rb  
(working copy)  
@@ -109,5 +109,5 @@

# Returns the publicly-addressable relative URI for the given asset,

## type and plugin def self.plugin\_asset\_path(plugin\_name, type, asset) raise “No plugin called ‘#{plugin\_name}’ - please use the full name of a loaded plugin.” if Engines.plugins[plugin\_name].nil?

“/#{Engines.plugins[plugin\_name].public\_asset\_directory}/#{type}/#{asset}”  
+  
“#{@controller.request.relative\_url\_root}/#{Engines.plugins[plugin\_name].public\_asset\_directory}/#{type}/#{asset}”  
end

Can someone point me in the right direction?

Thanks,

John
