Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How to migrate to Active Storage without losing...
Search
Colleen
May 02, 2019
Technology
0
2.4k
How to migrate to Active Storage without losing your mind
A talk on migrating from paperclip to active storage, common pitfalls, and lessons learned.
Colleen
May 02, 2019
Tweet
Share
More Decks by Colleen
See All by Colleen
Rekindling a love of creation with Ruby and the Raspberry pi
colleen711
0
230
Other Decks in Technology
See All in Technology
より良いプロダクトの開発を目指して - 情報を中心としたプロダクト開発 #phpcon #phpcon2025
bengo4com
1
3.2k
モバイル界のMCPを考える
naoto33
0
360
Github Copilot エージェントモードで試してみた
ochtum
0
130
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
26k
Zephyr RTOSを使った開発コンペに参加した件
iotengineer22
0
140
生成AI開発案件におけるClineの業務活用事例とTips
shinya337
0
180
Tech-Verse 2025 Keynote
lycorptech_jp
PRO
0
1.3k
タイミーのデータモデリング事例と今後のチャレンジ
ttccddtoki
4
1.4k
Tech-Verse 2025 Global CTO Session
lycorptech_jp
PRO
0
1.2k
Understanding_Thread_Tuning_for_Inference_Servers_of_Deep_Models.pdf
lycorptech_jp
PRO
0
150
Beyond Kaniko: Navigating Unprivileged Container Image Creation
f30
0
110
AIとともに進化するエンジニアリング / Engineering-Evolving-with-AI_final.pdf
lycorptech_jp
PRO
0
140
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Cult of Friendly URLs
andyhume
79
6.5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Adopting Sorbet at Scale
ufuk
77
9.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Being A Developer After 40
akosma
90
590k
Raft: Consensus for Rubyists
vanstee
140
7k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Into the Great Unknown - MozCon
thekraken
39
1.9k
How STYLIGHT went responsive
nonsquared
100
5.6k
Transcript
Bitmapped Designs Colleen Schnettler Bitmapped Designs LLC www.bitmappeddesigns.com Bitmapped Designs
How to Migrate To Active Storage Without losing your mind
@leenyburger Bitmapped Designs www.bitmappeddesigns.com A story… Fun Startup Rails Developer
Migrate to Active Storage Start of a beautiful contract relationship!
@leenyburger Bitmapped Designs www.bitmappeddesigns.com What is Active Storage? Active Storage
is an easy way to attach files to Active Record objects and store those files in cloud based storage. S3 User Avatar
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Why Active Storage? Paperclip is deprecated
No additional migrations Built in solution for handing file uploads to cloud storage Supports: Amazon S3, Google Cloud Storage, Microsoft Azure
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Documents Install Active Storage
Step 1: Step 4: Configure Cloud Storage Step 2: Add an attachment to a model Step 3:
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Implementing Active Storage in a new
application is EASY
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Migrating to Active Storage is hard.
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Why? Active Storage is fundamentally different
from paperclip. Paperclip works by attaching file data to the model Avatar added to User table Avatar User (Ernie)
@leenyburger Bitmapped Designs www.bitmappeddesigns.com User table schema is changed ernie-avatar.jpg
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage is different Active Storage
creates 2 new tables 1. Active Storage Attachments 2. Active Storage Blobs
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Documents Install Active Storage
Step 1: Step 4: Configure Cloud Storage Step 2: Add an attachment to a model Step 3:
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Create Active Storage Tables
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Configure Cloud Storage
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Configure Cloud Storage
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Documents Install Active Storage
Step 1: Step 4: Configure Cloud Storage Step 2: Move avatar data from User table to Active Storage Tables Step 3:
@leenyburger Bitmapped Designs www.bitmappeddesigns.com A rake task!
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Map attachment data FROM the Users
table TO Active Storage Tables Users Table Active Storage Attachments Active Storage Blobs
@leenyburger Bitmapped Designs www.bitmappeddesigns.com User table schema is changed ernie-avatar.jpg
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Map attachment data FROM the Users
table TO Active Storage Tables Users Table Active Storage Attachments Active Storage Blobs
But Wait?!
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Attachments Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Attachments Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Attachments Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage BLOBS Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage BLOBS Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage BLOBS Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage BLOBS Table
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Table mapping
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Table mapping
@leenyburger Bitmapped Designs www.bitmappeddesigns.com A rake task!
Step 1 Reference the Paperclip “Migration" Guide
Step 2
@leenyburger Bitmapped Designs www.bitmappeddesigns.com User table schema is changed ernie-avatar.jpg
Step 2
Step 3 user
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Two deploys required!
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Two deploys? Rake task needs: 1.
user.avatar relaSonship defined by paperclip 2. AcSve storage tables
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Two deploys? AcUve Storage needs: 1.
Data in the acSve storage tables
Step 3
Key and Checksum ∑
Step 3
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Run Rake Task Records created? AcSveStorage::Blob.count
AcSveStorage::AWachment.count
What we’ve done 2. Configured AcSve Storage Cloud Storage 1.
Created the AcSve Storage Tables 3. WriWen a rake task to create User Avatar records in the AWachments and Blobs tables 4. Confirmed records were created in the AcSve Storage Tables
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Make and checkout a new branch
No really. Do it.
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Deploy Deploy with paperclip, rake task,
and active storage tables Deploy with Active Storage models/views S3 dev_bucket 1. Run rake task
Update Views, Models, Controllers and Tests Models: Views:
@leenyburger Bitmapped Designs www.bitmappeddesigns.com What are variants? No image processing!
Paperclip Active Storage
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Too early to the party? 6
To save the day!
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Deploy Deploy with paperclip, rake task,
and active storage tables Deploy with Active Storage models/views S3 dev_bucket
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Active Storage Documents Install Active Storage
Step 1: Step 4: Configure Cloud Storage Step 2: Move avatar data from User table to Active Storage Tables Step 3:
@leenyburger Bitmapped Designs www.bitmappeddesigns.com Congrats!