O'Reilly logo

Learn Rails 5.2: Accelerated Web Development with Ruby on Rails by Stefan Wintermeyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Stefan Wintermeyer 2018
Stefan WintermeyerLearn Rails 5.2https://doi.org/10.1007/978-1-4842-3489-1_17

17. Active Storage

Stefan Wintermeyer
(1)
Bochum, Germany
 
Ruby on Rails 5.2 introduced Active Storage , which can be used to attach files (e.g., avatar images) to objects and store those files on the server or in the cloud.
Not only can Active Storage store files, but it can also convert and resize them. In this chapter, I will show you how to attach a file to give you the basic idea of how Active Storage works.

Avatar Example

First, I’m sorry for not coming up with a more original example! Everybody uses avatars to describe how to attach something, but I will do it too because it is such a common use case.
Let’s create a new phone book application ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required