Friday, 27 September 2019

Rails Image Upload: Using CarrierWave

Rails Image Upload: Using CarrierWave

     gem 'carrierwave', '~> 2.0'
 
4. Check out this file for some hints on how you can customize your uploader.
    It should look something like this:
    
     class AvatarUploader < CarrierWave::Uploader::Base
        storage :file
     end
 
5. Add a string column to the model you want to mount the uploader by creating 
    a migration:
      rails db:migrate
 
    class User < ActiveRecord::Base
      mount_uploader :avatar, AvatarUploader
    end
 
 
 


 


 

No comments:

Post a Comment

  Common Git Commands   Take clone of a repository git clone <remote-repository-url> ex: git clone  https://github.com/agricor/RegTech...