Active Storage

Active Storage provides file uploads for Rails applications and is the storage mechanism for Action Text, Action Mailbox, and more.

Using Active Storage

Active Storage is installed by default in Jumpstart Pro.

Check out the GoRails screencast episodes on Active Storage and the Active Storage Rails Guide for more information on how to use Active Storage.

For production, we strongly recommend using a CDN for serving files. Active Storage processes images through Rails which can add unncessary load to your Rails application and slow down your app if you don't have a CDN in production.

Direct Uploads

Direct uploads with Active Storage are enabled by default. To enable the Javascript on a file field, simply add direct_upload: true.

<%= form.file_field :attachments, multiple: true, direct_upload: true %>

The Trix editor is also preconfigured to use direct uploads when uploading attachments.

User Avatars

Users have default avatars using Gravatar, but they may override this by uploading their own avatar. These avatars are uploaded and processed using Active Storage.

Orphaned Uploads

Sometimes a user might upload a file but close the tab leaving an orphaned file in storage. To clean these up, we need to run a cron job regularly to purge any unattached blobs from ActiveStorage.

Jumpstart Pro comes with a Rake task you can run nightly to purge any orphaned, unattached blobs. Simply add this to cron or as a scheduled job:

rails active_storage:cleanup