rails_tiny_mce
rails_tiny_mce copied to clipboard
Does not honor RAIL_RELATIVE_URL_ROOT for Passenger based deployments
Hi,
I am having issues in getting the plugin image/upload mechanism to work properly when deployed under passenger to shared environment. My application is hosted in an environment shared by multiple applications.
http://myhost.com/mygroup/myapp/
The TinyMCE installation uses hardcoded paths to images such as: "/images/tiny_mce/spinner.gif" which will look for the file at:
"http://myhost.com/images/tiny_mce/spinner.gif" which makes it an invalid link.
The Passenger installation passes an environment variable called RAILS_RELATIVE_URL_ROOT which could be used in such cases to link to the right image at:
"http://myhost.com/mygroup/myapp/images/tiny_mce/spinner.gif"
I have tried using the :relative_url and :document_base_url settings but could not get either to work properly. I am either missing something fundamental / doing something stupid but otherwise have not been able to get the plugin file upload to work.
Any suggestions?
Can you change related urls to get it work with your app if that works let me know so that i can do configurable change.
On Fri, May 27, 2011 at 10:16 PM, kodbale < [email protected]>wrote:
Hi,
I am having issues in getting the plugin image/upload mechanism to work properly when deployed under passenger to shared environment. My application is hosted in an environment shared by multiple applications.
http://myhost.com/mygroup/myapp/
The TinyMCE installation uses hardcoded paths to images such as: "/images/tiny_mce/spinner.gif" which will look for the file at:
"http://myhost.com/images/tiny_mce/spinner.gif" which makes it an invalid link.
The Passenger installation passes an environment variable called RAILS_RELATIVE_URL_ROOT which could be used in such cases to link to the right image at:
"http://myhost.com/mygroup/myapp/images/tiny_mce/spinner.gif"
I have tried using the :relative_url and :document_base_url settings but could not get either to work properly. I am either missing something fundamental / doing something stupid but otherwise have not been able to get the plugin file upload to work.
Any suggestions?
Reply to this email directly or view it on GitHub: https://github.com/sandipransing/rails_tiny_mce/issues/11
sαη∂ιρ Rαηѕιηg
JOsh SOftware PVt. LTd.
web www.joshsoftware.com blog www.funonrails.com twitter @sandipransing skype sandip.ransing
Firstly, thanks for responding. Your plugin did save me a lot of time and I am thankful to you for sharing it and maintaining it.
Given a project time crunch, I did get it to work on my installation by just hardcoding the paths. Unfortunately that is not a very portable or elegant change - I had to make approximately 10-20 edits in the HTML/JS code to get it to nominally work on my installation, but since all the locations were easily "grep"able, it was not really that bad.
Using the ActionView helpers such as image_tag would be ideal but since the file upload dialog is static HTML, there was little I could see as a quick fix hence I adopted the hard-coded path hack!
Cool..Sounds great !!
But As per my consideration all the urls needs to loaded through yml file so that urls can be easily configurable for more generalized usage. What say ??
Thanks! On Tue, May 31, 2011 at 8:06 PM, kodbale < [email protected]>wrote:
Firstly, thanks for responding. Your plugin did save me a lot of time and I am thankful to you for sharing it and maintaining it.
Given a project time crunch, I did get it to work on my installation by just hardcoding the paths. Unfortunately that is not a very portable or elegant change - I had to make approximately 10-20 edits in the HTML/JS code to get it to nominally work on my installation, but since all the locations were easily "grep"able, it was not really that bad.
Using the ActionView helpers such as image_tag would be ideal but since the file upload dialog is static HTML, there was little I could see as a quick fix hence I adopted the hard-coded path hack!
Reply to this email directly or view it on GitHub: https://github.com/sandipransing/rails_tiny_mce/issues/11#comment_1267389
sαη∂ιρ Rαηѕιηg
JOsh SOftware PVt. LTd.
web www.joshsoftware.com blog www.funonrails.com twitter @sandipransing skype sandip.ransing
Sure, it would certainly help to have a configuration setting.
But on the other hand, why use a configuration setting when the configuration is already available as an environment variable. It leaves one less thing to worry about right? One can check if RAILS_RELATIVE_URL_ROOT is defined, use it if it is and ignore it if it not defined.
Another idea is to use the value defined in "config.action_controller.relative_url_root" thereby pushing up the responsibility for setting the URL to application layer instead of the plugin. I wonder if that would work? Either way, it still means that the HTML/JS needs to be tweaked to use ERB (and RJS?). That is what I would be concerned above all else.