2

I have an application that uses redactor (a wysiwyg editor) it works perfectly locally, and it also works when I upload it, except the config file, which is located in a subfolder doesent do anything, when pushing to Heroku. I tried precompiling, using:

RAILS_ENV=production bundle exec rake assets:precompile

and

bundle exec rake assets:precompile

I have config.assets.enabled = false

The config.js file, that is not working on Heroku, is included in application.js as redactor-rails/config

What can be the problem ?

Jamie Folsom
  • 1,287
  • 2
  • 10
  • 20
jakobk
  • 1,120
  • 1
  • 14
  • 26

1 Answers1

6

Have you added config.js to your local git repository before pushing?

[Edit]

A couple more things to check. Are you using the redactor-rails gem, and if so, is it in your gemfile?

gem 'jquery-rails'
gem 'redactor-rails'

Is your gemfile.lock checked into git?

[Edit 2]

I've now tested this out, and indeed, there's an issue with redactor-rails, which causes custom config to be overwritten by the gem's default.

On the github repo, there is a solution, which I've tested on heroku, and copied here:

rails generate redactor:config generates the file app\assets\redactor-rails\config.js. This will not work in the asset pipeline correctly as the rake assets:precompile task will still take config.js from the gem instead of the app (not that it'll work fine in development though). See Overriding backend assets in production environment

The solution is to create your own config.js (or any file name) and put it anywhere in your >app's assets. Then when requiring redactor, instead of //= require redactor-rails, use:

//= require redactor-rails/redactor.min
//= require path/to/custom/config

Works for me. Hope that helps. https://github.com/SammyLin/redactor-rails/issues/16

Community
  • 1
  • 1
Jamie Folsom
  • 1,287
  • 2
  • 10
  • 20
  • Works! - I forgot to re-compile using: RAILS_ENV=production bundle exec rake assets:precompile. But after that it works.. awesome! – jakobk Sep 12 '12 at 10:19
  • hi guys, did the same steps, but didn't work for me, using it on heroku, any ideas? – Said Kaldybaev Feb 10 '13 at 15:38
  • If you did the above and it didn't work -- be sure you're not using jQuery 1.9, which broke redactor for me. jquery-rails 2.2.0 packages jquery 1.9. Specify jquery-rails ~> 2.1.4 in your gemfile. – Jamie Folsom Feb 11 '13 at 21:01