Forum: Rails Engines development relative_url_root in Engines::RailsExtensions::AssetHelpers.plugin_asset_path

4ffeb4a96afa86c60ed62f9a0ea4b53e?d=identicon&s=25 John Koleszar (Guest)
on 2009-08-11 17:09
(Received via mailing list)
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
This topic is locked and can not be replied to.