Posts

Showing posts from May, 2021

Getting Started With Rails Active Storage

Image
Storing the static files in Rails is an important specification achieved by third-party gems (like Paperclip or CarrierWave). Rails, then, introduced the idea of  Active Storage in Rails 5.2 , which reduces the use of third-party gems required for storing static files and provides an easy way to store them.   Get Started with Active storage: To start with Active Storage , create a new application or simply run the following command in the existing rails application with the help of the command line or in terminal:     Run the migrate command to display the migration file in the database. After running the above-mentioned command, Rails will create a migration file. While inspecting the generated migration file, it will show 2 different tables created by running the command. First is the active_storage_blobs, which contains data files like checksum, filename and so on.   The following table showcases active_storage_attachments, a polymorphic association, which st...