Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Inside Active Storage: a code review of Rails' new framework by Claudio Baccigalupo Rails 5.2 ships with a new library to support file uploads: Active Storage. In this talk, we will analyze its internal code, learning how it integrates with Active Record and Action Pack to supply amazing features out of the box, from image previews to cloud storage. We will review its class architecture and delve into the implementation of several Active Storage methods, such as has_one_attached and upload. On the way, we will better understand some Ruby patterns frequently used within Rails: meta-programming, macros, auto-loading, initializers, class attributes.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In this video presentation titled "Inside Active Storage: a code review of Rails' new framework," Claudio Baccigalupo discusses the newly introduced file upload library in Rails 5.2 known as Active Storage. The session, conducted at RailsConf 2018, provides insights into both the usage and internal workings of Active Storage, showcasing how it integrates with Rails components like Active Record and Action Pack. Baccigalupo invites attendees to explore the code, emphasizing its elegance and the potential for community contributions. Key points from the presentation include: - **Introduction to Active Storage**: Active Storage simplifies file uploads in web applications, bundled within Rails 5.2, replacing previous third-party options like Paperclip. - **Basic Usage**: Demonstrating through a scaffold application, users can easily integrate file uploads by simply adding a file field in HTML, whitelisting parameters in the controller, and using the `has_one_attached` method in the model. - **Functionality and Features**: Besides basic uploads, Active Storage supports various functionalities like generating image variants, dealing with PDFs, and handling multiple attachments with methods such as `has_many_attached`. - **Understanding Class Architecture**: The presentation covers three main classes within Active Storage: - **ActiveStorage::Service**: Manages the movement of bytes and abstracted storage solutions (e.g., local disk or cloud storage). Different implementations are provided, including local disk and cloud services like AWS S3. - **ActiveStorage::Blob**: Stores metadata about the uploaded file and its location in the database. Installation and migration commands are pointed out for setting up necessary database tables. - **ActiveStorage::Attachment**: Connects blobs to the relevant records in models, establishing associations between uploaded files and database entries. - **Metaprogramming and Extending Rails**: Baccigalupo highlights how Active Storage adds functionality to Active Record through metaprogramming, demonstrating how method definitions can create a seamless user experience with minimal code. - **Conclusion and Encouragement to Contribute**: The talk concludes with an invitation for developers to experiment with Active Storage, dive into the codebase, and contribute, as it is a young framework with room for documentation and feature improvements. Overall, the session serves as both a guide to utilizing Active Storage effectively and an encouragement for greater community engagement in Rails development.
Suggest modifications
Cancel