This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
desc "Find orphaned records. Set DELETE=true to delete any discovered orphans." | |
task :find_orphans => :environment do | |
found = false | |
model_base = Rails.root.join('app/models') | |
Dir[model_base.join('**/*.rb').to_s].each do |filename| | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### S3 implementation of Paperclip module that supports deep | |
### cloning of objects by copying image attachments. | |
### | |
### Tested with: aws-sdk (1.33.0) | |
### | |
### Refer to Paperclip issue: https://github.com/thoughtbot/paperclip/issues/1361#issuecomment-39684643 | |
### Original gist works with fog: https://gist.github.com/stereoscott/10011887 | |
### gist works from which this code is derived: https://gist.github.com/ksin/7747334d60b1947f14e9 | |
module Paperclip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/paperclip/copy_attachments.rb | |
# Copies S3-stored Paperclip attachments from one AR model to another. | |
# | |
# This module should be mixed into the target AR model. | |
if Gem::Version.new(::AWS::VERSION) >= Gem::Version.new(2) | |
raise NotImplementedError, 'coded for aws-sdk v1' | |
end |