3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Ruby on Rails】gem refileの保存先変更※備忘録

Last updated at Posted at 2020-09-05

gemのrefileを使用していて、
つまずいたため、備忘録として残します。
※本来の方法ではないかもしれないため、参考程度に見ていただければと思います。

開発環境

ruby 2.5.7
Rails 5.2.4.3
OS: macOS Catalina

refileの保存先変更

何もしていない時の保存先

tmp/uploads/store
この配下にあるものの、tmp=temporaryの字のごとく、
一時的に保存される場所です。

変更したい保存先

public/uploads配下に保存したい場合、
config/initializers配下にrefile.rbを作成。

config/initializers/refile.rb
Refile.backends['store'] = Refile::Backend::FileSystem.new('public/uploads/')

このようにすればpublic/uploads配下に保存可能。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?