Question

I just installed carrierwave and have set my rails 4 app up to store images on Amazon s3 through fog. The app was working and deploying to Heroku with Carrierwave (but images were getting purged with dyno). After some initial issues I got it working on my localhost (as far as I could tell).

Now I am having trouble pushing the new version to Heroku. I have reset the DATABASE. Precompiled the assets and now trying to migrate the database. Below is the error I'm getting.

Running `rake db:migrate` attached to terminal... up, run.6517
rake aborted!
uninitialized constant Sprockets::Helpers
/app/app/uploaders/image_uploader.rb:12:in `<class:ImageUploader>'
/app/app/uploaders/image_uploader.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment

I have tried to include and not include Sprockets in the Uploader file and get the same error either way. I understand that Sprockets is no longer included in the master for Rails 4. I have now installed the sprockets-rails and sprockets-helper gems. I have also tried to require them at the top of the file (I don't understand this completely, but following this suggestion https://github.com/petebrowne/sprockets-helpers). Nothing has worked. Any suggestions about how I can go about resolving this. How do I initialize Sprockets::Helpers. Thanks.

Was it helpful?

Solution

I was making a pretty silly mistake. I had corrected files in my app and as committing the changes to the master, but I kept running the heroku run rake db:migrate command and getting the same error, so I didn't think I have resolved it yet. I had forgotten to push the new version to heroku! Hence the reason for still getting the same error.

Also, in case anyone else has a similar issue. Make sure you have fixed this:

https://github.com/carrierwaveuploader/carrierwave/issues/1020

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top