[Ruby on Rails] Change the save destination of gem refile * Note

I'm using a gem refile I stumbled, so I will leave it as a memorandum.

Development environment

ruby 2.5.7 Rails 5.2.4.3 OS: macOS Catalina

Change the save destination of refile

Save destination when nothing is done

tmp/uploads/store Although it is under this, like the character tmp = temporary, This is a temporary storage location.

Save destination you want to change

If you want to save under public / uploads Create refile.rb under config / initializers.

config/initializers/refile.rb


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

If you do this, you can save it under public / uploads.

Recommended Posts

[Ruby on Rails] Change the save destination of gem refile * Note
A note about the seed function of Ruby on Rails
part of the syntax of ruby ​​on rails
Change the save destination of the image to S3 in the Rails app. Part 2
[Ruby on Rails] How to make the link destination part of the specified id
Docker the development environment of Ruby on Rails project
[Ruby on Rails] How to change the column name
Try using the query attribute of Ruby on Rails
(Ruby on Rails6) Display of the database that got the id of the database
Delete all the contents of the list page [Ruby on Rails]
[Note] About the Fizz_Buzz problem (How Ruby on Rails works)
Basic knowledge of Ruby on Rails
Note on the path of request.getRequestDispatcher
[Ruby On Rails] How to search and save the data of the parent table from the child table
Erase N + 1 in acts_as_tree of tree structure Gem of Ruby on Rails
[Ruby on Rails] Introduction of initial data
[Rails] Addition of Ruby On Rails comment function
Let's summarize "MVC" of Ruby on Rails
[Rails] Change the label name of f.label
[Ruby on Rails] Japanese notation of errors
Explanation of Ruby on rails for beginners ①
[Ruby on rails] Implementation of like function
How to implement gem "summer note" in wysiwyg editor in Ruby on Rails
Environment construction of Ruby on Rails from 0 [Cloud9] (From Ruby version change to Rails installation)
How to solve the local environment construction of Ruby on Rails (MAC)!
Ruby on Rails When you don't know the cause of rollback when saving.
[Ruby On Rails] How to search the contents of params using include?
Implementation of Ruby on Rails login function (Session)
When the Ruby on Rails terminal rolls back
Recommendation of Service class in Ruby on Rails
Ruby on Rails ~ Basics of MVC and Router ~
[Ruby on Rails] A memorandum of layout templates
Determine the current page with Ruby on Rails
[Ruby on Rails] Upload multiple images with refile
[Ruby on Rails] Individual display of error messages
[Rails 6] Change redirect destination at the time of new registration / login by devise
[Ruby on Rails] Change the update date and creation date to your favorite notation
[Ruby on Rails] Rails tutorial Chapter 14 Summary of how to implement the status feed
[Ruby on Rails] Implement a pie chart that specifies the percentage of colors
[Ruby on Rails] How to Japaneseize the error message of Form object (ActiveModel)
[Ruby on Rails] Implementation of validation that works only when the conditions are met
[Ruby on Rails] Asynchronous communication of posting function, ajax
Implementation of Ruby on Rails login function (devise edition)
[Ruby on Rails] Change URL id to column name
[Ruby on Rails] Implementation of tagging function/tag filtering function
[Rails] How to change the column name of the table
[Rails] Cancel / change the default password validation of devise
Ruby on Rails Elementary
Ruby on Rails basics
[Ruby on Rails] Post image preview function in refile
Solve the N + 1 problem with Ruby on Rails: acts-as-taggable-on
Ruby On Rails Association
Explanation of Ruby on rails for beginners ⑥ ~ Creation of validation ~
Get the URL of the HTTP redirect destination in Ruby
[Ruby on Rails] From MySQL construction to database change
Explanation of Ruby on rails for beginners ② ~ Creating links ~
(Ruby on Rails6) Reflecting the posted content from the form
Explanation of Ruby on rails for beginners ⑦ ~ Flash implementation ~
[Ruby on Rails] Only the user who posted can edit
[Rails] Put the same restrictions on multiple pieces of information
Ruby on Rails for beginners! !! Summary of new posting functions