redactor-rails icon indicating copy to clipboard operation
redactor-rails copied to clipboard

Unicorn Rails + Redactor Rails 0.3.3 = uninitialized constant RedactorRails::Document (NameError)

Open Gedrovits opened this issue 12 years ago • 13 comments

Hey. Recently gem was updated and if you try to start Unicorn server it fails, because can't find document model.

This is the stacktrace:
I, [2013-02-07T16:02:16.989869 #27768]  INFO -- : Refreshing Gem list
/home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/redactor-rails-0.3.3/lib/redactor-rails.rb:30:in `document_model': uninitialized constant RedactorRails::Document (NameError)
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/redactor-rails-0.3.3/app/controller/redactor_rails/documents_controller.rb:2:in `<class:DocumentsController>'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/redactor-rails-0.3.3/app/controller/redactor_rails/documents_controller.rb:1:in `<top (required)>'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:438:in `each'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:438:in `block in eager_load!'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:436:in `each'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:436:in `eager_load!'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `each'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `all'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:434:in `eager_load!'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/isamashii/web/app/releases/20130207140018/config/environment.rb:5:in `<top (required)>'
    from config.ru:4:in `require'
from config.ru:4:in `block in <main>'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn.rb:44:in `eval'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn.rb:44:in `block in builder'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn_rails:139:in `call'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn_rails:139:in `block in rails_builder'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:700:in `call'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:700:in `build_app!'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:139:in `start'
from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn_rails:209:in `<top (required)>'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in `load'
    from /home/isamashii/web/app/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in `<main>'

Gedrovits avatar Feb 07 '13 14:02 Gedrovits

+1 Same issue on production

tmedetbekov avatar Feb 09 '13 08:02 tmedetbekov

+1 getting the same error on heroku

Saidbek avatar Feb 10 '13 14:02 Saidbek

+1 in combination with thin

ivdma avatar Feb 10 '13 15:02 ivdma

resolved this error, used steps: https://github.com/SammyLin/redactor-rails/issues/16

Saidbek avatar Feb 10 '13 16:02 Saidbek

@saidbek's solution did not work for me either.

krnjn avatar Feb 11 '13 14:02 krnjn

Is there a solution already? I didn't understand the solution from the link of @Saidbek

javiayala avatar Feb 11 '13 18:02 javiayala

+1 on what @jawks said

gabrielpoca avatar Feb 11 '13 18:02 gabrielpoca

hi guys, this is really strange. Me also was getting the same error (uninitialized constant RedactorRails::Document) while installing this gem on heroku, and then found that link, did the same steps, deployed to heroku and it started working as it should. But today i just created test app and did the pretty straightforward installation. I've push it to the heroku, you can view it here: http://immense-brushlands-1998.herokuapp.com/products/new

Saidbek avatar Feb 13 '13 19:02 Saidbek

@saidbek do you mind publishing that app on github so we can see the exact code you used? sometimes we set things up a bit differently and it would help to see all the configuration you do and try it on our own apps. thanks.

krnjn avatar Feb 13 '13 19:02 krnjn

@jiangkeren yes sure, here's a repo: https://github.com/Saidbek/test-redactor

Saidbek avatar Feb 13 '13 19:02 Saidbek

I had the same error in my production environment (using Passenger) and it turns out I was missing app/models/redactor_rails/document.rb and app/uploaders/redactor_rails_document_uploader.rb. I fixed it by running rails generate redactor:install on a new rails app and copying those two files into my existing app.

adelang avatar Feb 14 '13 09:02 adelang

Thanks @adelang -- that was the correct solution!

krnjn avatar Feb 14 '13 17:02 krnjn

Thanks @adelang , But I think, it's not the right solution for the future, should i do every deploy?

I hope this problem will be fixed soon.

fauzieuy avatar May 06 '13 02:05 fauzieuy