Upgrade to Pro — share decks privately, control downloads, hide ads and more …

I Tried Using ActiveStorage

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

I Tried Using ActiveStorage

ProductionコードでのActiveStorageの導入を検討

Avatar for Sho Sundberg

Sho Sundberg

March 29, 2019
Tweet

Other Decks in Education

Transcript

  1. 1 What is Active Storage? Active Storage facilitates uploading files

    to a cloud storage service like Amazon S3, Google Cloud Storage, or Microsoft Azure Storage and attaching those files to Active Record objects. It comes with a local disk-based service for development and testing and supports mirroring files to subordinate services for backups and migrations. Using Active Storage, an application can transform image uploads with ImageMagick, generate image representations of non-image uploads like PDFs and videos, and extract metadata from arbitrary files. https://edgeguides.rubyonrails.org/active_storage_overview.html 6
  2. 7

  3. Carrierwave ActiveStorage Shrine 安定性 ❍ ◎ ❍ 導入の楽さ ❍ ◎

    ❍ クラウドストレージ連 携 ❍ ❍ ❍ ダイレクトアップロー ド ❍ ❍ ❍ 楽観的想定 12
  4. - 既に ActiveStorageが 入ってるので、rails active_storage:install - 自動生成される migration をただ実行 -

    database.yml っぽく storage.yml で接続上方を管理 - has_one_attached をモデルに定義すれば 終わり インストールはとにかく簡単 17
  5. 23

  6. 27

  7. 28

  8. Carrierwave ActiveStorage Shrine サービスの安定性 (メンテナンス) ❍ ◎ ❍ 導入の楽さ (Rails

    newから開発までの時間 ) ❍ ◎ ❍ クラウドストレージ連携 + ストレージ上ファイル管理 ❍ CarrierWave store_dir override △ ActiveStorage 次第 ❍ generate_location メソッド定義 機能拡張性 (機能追加のしやすさ ) ◎ gemが充実 △ gemが未熟・拡張前提がない ◎ plugin 指定 画像処理 ❍ image_processing ◎ image_processing(configで選択) ❍ image_processing ファイルのバージョン管理 (ElasticTranscoderの結果など) ❍ `version` で処理後複数管理 △ `variants` があるが命名不可 ❍ `versions` で処理後複数管理 ファイルバリデーション ❍ CarrierWave validation methods △ 導入予定(?) ❍ validation_helpers plugin DB上での汎用性 ❍ 各テーブル △ PolymorphicでのActiveStroage一括管理 ❍ 各テーブル 31