Created
August 31, 2016 11:25
-
-
Save renchap/ca16dd38c59196b9f55d012741a46443 to your computer and use it in GitHub Desktop.
shrine_concatenation
This file contains hidden or 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
class ImageParts << ActiveRecord::Base | |
include PartUploader[:file] | |
belongs_to :image | |
end | |
class Image << ActiveRecord::Base | |
include ImageUploader[:file] | |
has_many :image_parts | |
[...] | |
def create_file_from_parts! | |
file.create_from_concatenation image_parts.map(&:file), name: "#{id}.jpg" | |
save! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment