Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created April 28, 2019 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harrisonmalone/be85b8f4a2d33d52d0f667e971eb5be0 to your computer and use it in GitHub Desktop.
Save harrisonmalone/be85b8f4a2d33d52d0f667e971eb5be0 to your computer and use it in GitHub Desktop.
implement image uploads to a project you've already started on
for example, add an image upload field when you create a restaurant
optional
create a photos.google.com clone 📸
start with this structure for your models
- album model: name:string
- photos model: album:references
relationships
- an album has many photos
- a photo belongs to an album
- a photo has_one_attached :uploaded_image
advanced
- allow for users to upload many photos at once to an album
- allow for photos to belong to many albums therefore we have new relationships
relationships #2
- a photo has many albums
- an album has many photos
you will need a join table to get the job done 🤝
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment