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
AIのグローバルトレンド2025 #scrummikawa / global ai trend
kyonmm
PRO
1
280
react-callを使ってダイヤログをいろんなとこで再利用しよう!
shinaps
1
240
要件定義・デザインフェーズでもAIを活用して、コミュニケーションの密度を高める
kazukihayase
0
110
生成AIでセキュリティ運用を効率化する話
sakaitakeshi
0
660
JTCにおける内製×スクラム開発への挑戦〜内製化率95%達成の舞台裏/JTC's challenge of in-house development with Scrum
aeonpeople
0
210
未経験者・初心者に贈る!40分でわかるAndroidアプリ開発の今と大事なポイント
operando
5
480
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
560
現場で効くClaude Code ─ 最新動向と企業導入
takaakikakei
1
240
AWSを利用する上で知っておきたい名前解決のはなし(10分版)
nagisa53
10
3.1k
サンドボックス技術でAI利活用を促進する
koh_naga
0
200
Webアプリケーションにオブザーバビリティを実装するRust入門ガイド
nwiizo
7
800
dbt開発 with Claude Codeのためのガードレール設計
10xinc
2
1.2k
Featured
See All Featured
For a Future-Friendly Web
brad_frost
180
9.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
What's in a price? How to price your products and services
michaelherold
246
12k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
Typedesign – Prime Four
hannesfritz
42
2.8k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Thoughts on Productivity
jonyablonski
70
4.8k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Visualization
eitanlees
148
16k
Speed Design
sergeychernyshev
32
1.1k
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!