Relative_url_root in Engines::RailsExtensions::AssetHelpers.plugin_asset_path


#1

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