Next storage for paperclip. Based on Filesystem but offering files versioning support.
Add this line to your application's Gemfile:
gem 'paperclip_storage_filesystem_versioned'
And then execute:
$ bundle
Or install it yourself as:
$ gem install paperclip_storage_filesystem_versioned
Paper_trail or similar installed. This storage do not make own versions, just save every new file in another path based on version number of model.
Basic example (with paper_trial enabled):
class User < ActiveRecord::Base
has_attached_file :some_nice_document_or_whatever,
:storage => :filesystem_versioned
end
Little more complicated example (can define Proc
for version number determine):
class User < ActiveRecord::Base
has_attached_file :some_nice_document_or_whatever,
:storage => :filesystem_versioned,
:version_proc => Proc.new { |attachment, style| attachment.instance.versions.count}
end
- Fork it ( https://github.com/stricte/paperclip_storage_filesystem_versioned/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request