SammyLin / redactor-rails

This repo is deprecated. Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails
MIT License
389 stars 253 forks source link

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

Open Gedrovits opened 11 years ago

Gedrovits commented 11 years ago

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>'
tmedetbekov commented 11 years ago

+1 Same issue on production

Saidbek commented 11 years ago

+1 getting the same error on heroku

ivdma commented 11 years ago

+1 in combination with thin

Saidbek commented 11 years ago

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

krnjn commented 11 years ago

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

javiayala commented 11 years ago

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

gabrielpoca commented 11 years ago

+1 on what @jawks said

Saidbek commented 11 years ago

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

krnjn commented 11 years ago

@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.

Saidbek commented 11 years ago

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

adelang commented 11 years ago

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.

krnjn commented 11 years ago

Thanks @adelang -- that was the correct solution!

fauzieuy commented 11 years ago

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.