Posted over 3 years ago. Visible to the public.

Basic file uploads and image versions

Goals

  • Learn to treat files as an ActiveRecord attribute type, like :string or :integer

Research

Exercise

In MovieDB, allow movie authors to upload a movie poster using the carrierwave gem:

  • The poster should be uploaded in the form where we can also fill in title, year, etc.
  • On the movie show view, render a poster version that is 400 pixel wide, with a height that respects the aspect ratio of the original image
  • On the movie index view, render a poster version that is 100 pixel wide and cropped to 100 pixel height, regardless of the original aspect ratio
  • On the movie show view, offer a link to download the original poster image file.
  • When editing a movie, offer controls to delete or replace the poster image file.

You do not need to treat movie posters as confidential, so it's not important if an unauthorized user can see a poster.

Make sure to add integration tests for adding, changing and deleting a poster image.

Owner of this card:

Avatar
Henning Koch
Last edit:
7 months ago
by Florian Leinsinger
Posted by Henning Koch to makandra Curriculum
This website uses cookies to improve usability and analyze traffic.
Accept or learn more