Premium Content - Free Preview
Mr. Blackford likes the store you created, but he just realized the products don't have any pictures. "Sears catalog has pictures," he tells you, "Can you add a picture capability to my store's products?"
Let's add an image capability to products. As usual, you can look into using a gem or addon (such as Filepicker) to help with uploading and processing images. However, since products are just created by admins you can host an image elsewhere and just display it on the product page. This means you just need to add a column to products for an image_url, and can they display it on the product page.
1 - Go ahead and create the migration to add image_url to products.
Enter the following code in your terminal:
rails generate migration AddImageURLToProducts image_url:string
rake db:migrate to run the migration.