No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Gems main responsibility is to provide service for copying Carrierwave files between records
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
~> 0.14
>= 0
>= 0

Runtime

 Project Readme

Build Status Code Climate Coverage Status Gittens Open Thanks

CopyCarrierwaveFile

Simple gem for copying CarrierWave files between resources. It's solving issues with local and remote storage discussed here

Installation

Add this line to your application's Gemfile:

gem 'copy_carrierwave_file'

And then execute:

$ bundle

Usage

You can use service class directly:

original_resource = User.last
new_resource      = User.new

CopyCarrierwaveFile::CopyFileService.new(original_resource, new_resource, :avatar).set_file
  # :avatar represents mount point (field)

new_resource.save

or you can include CopyCarrierwaveFile module and call copy_carrierwave_file :

class Document
  include CopyCarrierwaveFile  
  mount_uploader :content_file, MyUploader

  def duplicate_file(original)
    copy_carrierwave_file(original, self, :content_file)
    self.save!
  end
end

document = Document.new
document.duplicate_file(Document.last) 

Functionality is the same

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request