imagekit-developer / imagekit-developer/imagekit-ruby

How to migrate files from local persistent storage with CarrierWave correctly?

オープン
#62 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Ruby
スター
19
フォーク
8
平均マージ
47分
マージ済み PR(30日)
1

説明

Initially, the application used local persistent storage. I tried moving the entire uploads directory into ImageKit. I kept the previous configuration and added a new one from ImageKit:

class BaseUploader < CarrierWave::Uploader::Base
  include ImageKitIo::CarrierWave

  def store_dir
    full_file_path
  end

  # ...

  def options
    {
      response_fields: "isPrivateFile, tags",
      tags: %w[images],
      use_unique_file_name: false,
      folder: full_file_path
    }
  end

  private

  # ...

  def full_file_path
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{dirs}"
  end

  # ...
end

As a result I get this error:

unexpected token at 'f1843b5f9.jpg'

From this line:

= image_tag band.card_image.url

In this case, the full name of the file in the database is: 9757131f1843b5f9.jpg.

Please tell me what else needs to be done to migrate files?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

BaseUploader の設定と、issue に示されている image_tag band.card_image.url の呼び出しから始めます。既存のデータベースファイル名を使って失敗を再現し、CarrierWave/ImageKit の移行および URL の処理に関するドキュメントを確認します。報告されたエラーなしで、移行されたファイルを解決してレンダリングできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ruby
領域
backend, cloud
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。