y9v/carrierwave-base64

uninitialized constant CarrierWave::Mount (NameError)

dharshan opened this issue · 1 comments

Hi, I am trying carrierwave-base64 in a rails 5 api only application. I had User model with image as attribute.

I added "gem 'carrierwave-base64' " in my Gemfile and bundle it, which installed both carrierwave 1.2.2 and carrierwave-base64 2.6.1.

I generated uploader with "rails g uploader Image" to generate image_uploader.rb.

When I add " mount_base64_uploader :image, ImageUploader " to my User model It will show " uninitialized constant CarrierWave " error.

So, I searched in internet and found I need to add " require 'carrierwave/orm/activerecord " in application.rb or environment.rb.

After adding, I am not able to start rails server or rails console. It is giving error as
"module:ActiveRecord': uninitialized constant CarrierWave::Mount (NameError)".

I also tried by stopping spring but no use.

OS : Ubuntu 16.05
Database : PostgreSQL
Rails: 5.1.4
Ruby: 2.4

y9v commented

@DarshanD thank you for reporting.

I'm afraid this isn't a problem of carrierwave-base64 gem, rather carrierwave issue.

carrierwaveuploader/carrierwave#1103
https://stackoverflow.com/questions/33482399/moduleactiverecord-uninitialized-constant-carrierwavemount-nameerror