spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
815 stars 256 forks source link

Wrong asset_host on staging #95

Closed gnumarcelo closed 11 years ago

gnumarcelo commented 11 years ago

Hi, I'm using tinymce and it's working on my development environment, however, when I deploy it to my staging env it doesn't work. I found on the browser javascript console that tinymce.js is pointing to my production env host url. window.tinyMCEPreInit=window.tinyMCEPreInit||{base:"https://www.my_domain.com/assets/tinymce"...

Each of my env has it's own asset_host set. production: config.action_controller.asset_host = 'https://www.my_domain.com' develop: config.action_controller.asset_host = 'http://develop.my_domain.com'

Am I missing something?

Thank you!

spohlenz commented 11 years ago

What Rails environment is your staging server running? I'm assuming it is production so the TinyMCE base appears to be set correctly.

Are there any particular errors or assets that are failing to load? Have you run rake assets:precompile as part of your deployment process?

gnumarcelo commented 11 years ago

Hi there! Well, my Rails server env is set to staging, not production. RAILS_ENV: staging

All the assets loaded by the TinyMCE javascript are failing (because they are pointing to my production url).

https://myproductionsite.com/assets/tinymce/langs/en.js https://myproductionsite.com/assets/tinymce/themes/advanced/editor_template.js https://myproductionsite.com/assets/tinymce/plugins/table/editor_plugin.js (and all the others plugins) https://myproductionsite.com/assets/tinymce/themes/advanced/skins/default/ui.css https://myproductionsite.com/assets/tinymce/themes/advanced/skins/default/content.css

My app is running on Heroku Cedar and it runs rake assets:precompile as part of the deploy process.

Thanks for helping!

spohlenz commented 11 years ago

I'm guessing that Heroku is still compiling your assets using the production environment. A quick search led me to this issue (http://stackoverflow.com/questions/9830244/heroku-always-runs-assetsprecompile-with-the-production-environment-for-rails-3) and in particular this Heroku plugin (https://devcenter.heroku.com/articles/labs-user-env-compile) which I'm hoping will solve the issue.

gnumarcelo commented 11 years ago

You are right, this plugin solved the problem. Thank's man!