Search code examples
rubyrackruby-grape

How to work with rack using ruby for storing image on cloudinary with gem carrierwave


I am using rack framework with active record and there is no rails , so when i upload an image to cloudinary using carrierwave gem i am getting the following error.

Unexpected error while processing request: uninitialized constant Cloudinary::CarrierWave::Storage::Rails


Solution

  • Based off of this ,you can't use carrierwave gem without rails. You should be able to do something like:

    you can use meta-programming in ruby.

    Just override the class of Carrierwave and create a storage.rb file :

    Cloudinary::CarrierWave::Storage.class_eval do
     /// Your code here...
    end