Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
markuslopez
371 PointsQuestions about photo uploading...PAPERCLIP
How can I force users to upload a profile picture when they register?
How can I force users to attach a picture with every post?
How can I allow users to use a URL to upload a picture.
THANK YOU in advance to anyone who can help.
1 Answer
David Moore
13,916 PointsThat's a big question but to boil it down to its basics, for the first two I would say validations. Paperclip has several custom validations available, one being validates_attachment_presence.
As for using a url, you are going to need to do some URI work. There are a few examples just a Google search away. Here is one I located that seems fairly current and complete at first glance:
https://gist.github.com/jgv/1502777
Hope that helps!