-
-
Save sahidursuman/aa2d30136dea1917886e1ec5909bc2f6 to your computer and use it in GitHub Desktop.
Revisions
-
avogel3 revised this gist
Jul 21, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ # Ran into an issue recently where I wanted to use our custom prawn class to generate a PDF, then upload it to Amazon S3 using paperclip. # Let 'OurCustomPdf' be our prawn class. # Let the variable '@user' be our our model, has_many :documents # Let 'Document' be our paperclip model, belongs_to :user pdf = OurCustomPdf.new(@user, "pdf") upload = @user.documents.new upload.attachment = StringIO.new(pdf.render) upload.save! -
avogel3 created this gist
Jul 20, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ # Ran into an issue recently where I wanted to use our custom prawn class to generate a PDF, then upload it to Amazon S3 using paperclip. # Let 'OurCustomPdf' be our prawn class. # Let the variable '@user' be our our model, has_many :documents # Let 'Document' be our paperclip model, belongs_to :User pdf = OurCustomPdf.new(@user, "pdf") upload = Document.new(user_id: @user.id) upload.attachment = StringIO.new(pdf.render) upload.save!