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
240
Other Decks in Technology
See All in Technology
Developer Advocate / Community Managerなるには?
tsho
0
140
能登半島災害現場エンジニアクロストーク 【JAWS FESTA 2025 in 金沢】
ditccsugii
0
570
Uncle Bobの「プロフェッショナリズムへの期待」から学ぶプロの覚悟
nakasho
2
110
Git in Team
kawaguti
PRO
3
360
社内お問い合わせBotの仕組みと学び
nish01
1
580
HR Force における DWH の併用事例 ~ サービス基盤としての BigQuery / 分析基盤としての Snowflake ~@Cross Data Platforms Meetup #2「BigQueryと愉快な仲間たち」
ryo_suzuki
0
140
コンテキストエンジニアリング入門〜AI Coding Agent作りで学ぶ文脈設計〜
kworkdev
PRO
1
580
「使い方教えて」「事例教えて」じゃもう遅い! Microsoft 365 Copilot を触り倒そう!
taichinakamura
0
360
AI駆動開発を推進するためにサービス開発チームで 取り組んでいること
noayaoshiro
0
260
成長自己責任時代のあるきかた/How to navigate the era of personal responsibility for growth
kwappa
4
320
OCI Network Firewall 概要
oracle4engineer
PRO
2
7.9k
エンタメとAIのための3Dパラレルワールド構築(GPU UNITE 2025 特別講演)
pfn
PRO
0
260
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
How to Ace a Technical Interview
jacobian
280
24k
Typedesign – Prime Four
hannesfritz
42
2.8k
Balancing Empowerment & Direction
lara
4
690
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
The Cult of Friendly URLs
andyhume
79
6.6k
Optimizing for Happiness
mojombo
379
70k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Agile that works and the tools we love
rasmusluckow
331
21k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
620
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
53k
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!