Posted about 5 years ago. Visible to the public.

Basic file uploads and image versions [2d]


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



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:

Henning Koch
Last edit:
11 months ago
by Hannes Randow
Posted by Henning Koch to makandra Curriculum
This website uses short-lived cookies to improve usability.
Accept or learn more