David Whitmer

Joined

770 Experience
7 Lessons Completed
0 Questions Solved

Activity

Posted in How to write a conditional in a create action?

I can think of a couple ways to handle this but it mainly has to do with what the end product is trying to accomplish.

First I would use the shrine plugin, :determine_mime_type, to determine the file type.

Then you could either continue with your current approach of separating the files in to two separate models or you could set a field called "file_type" on your Attachment model. An attachment is either an "image" or a "document". Then you could create a scope on your Project model for attachments that queries file_type on the association, one for images and one for documents .

This allows you to then simply call project.images or project.documents.

Just my 2 cents and what came to mind when I read your question

Posted in Multiple File Uploads with Shrine Discussion

Chris-
Thanks a whole bunch for doing this series. Invaluable! Exactly what I needed.
Dave

Posted in Our First API (Example) - GoRails

Chris-
Love to see file uploads through an API. If it was possible to do direct to S3 that would be the icing on the cake.
Thanks,
Dave

Posted in Direct File Uploads to S3: Part 3 Discussion

Thanks for connecting all the dots on this one! Really appreciate it.

Posted in File Uploads in Rails With Shrine Discussion

I'm not tied to jQuery. Dropzone looks very cool. Just like to be able to do a direct upload to S3 with multiple file drag and drop / background upload/processing. Sounds like that's where you are headed with the videos, so I am down. Thanks!

Posted in File Uploads in Rails With Shrine Discussion

Thanks, Chris. The direct upload to S3 with JQuery has been on my list for awhile to figure out. It will be much appreciated!

Posted in File Uploads in Rails With Shrine Discussion

Request as you build the next few in the series that, if possible, you cover:
1) Direct upload to S3
2) JQuery/Multi-File/Background uploading

Thanks!