[RUBY] [Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error

problem

[Rails] Write the process at the time of Routing Error --Qiita I tried to avoid the Routing Error by referring to this article, but some of the refile images are no longer displayed.

Cause

** The attachment url added by refile is the target of unmatched_route **

As a countermeasure for Routing Error

routes.rb


get '*unmatched_route', to: 'home#about'

And, when a route other than the route written in routes.rb is specified, it was set to jump to the about page, but the route of the newly registered attachment image is also regarded as unmached_route, and those The tragedy that only the image jumps to the about page.

approach

Create a new config / initializers / refile.rb

config/initializers/refile.rb


Refile.automount = false
#refile unmount root automount

config/route.rb


mount Refile.app, at: Refile.mount_point, as: :refile_app
#refile Manual root mount
#All routes of attachment are acquired

reference

Recommended Posts

[Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
[Rails] What to do when the view collapses when a message is displayed with the errors method
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
What to do if the app is not created with the latest Rails version installed when rails new
What to do when javax.el.ELException: Not a Valid Method Expression: appears when the JSF screen is displayed
[IOS] What to do when the image is filled with one color
What to do if the background image is not applied after deployment
[Rails] About the error that the image is not displayed in the production environment
What to do if the image posted by refile disappears after setting a 404 error page in Rails
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do when rails db: seed does not reflect in the database
[Grails] Error occurred running What to do when the Grails CLI does not start
What to do if you get an "A server is already running." Error when you try to start the rails server
What to do when "Fail to load the JNI shared library" is displayed in Eclipse
What to do when Address already in use is displayed after executing rails s
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do if FacesMessage is set but not displayed
The idea of cutting off when the error is not resolved
[Rails] When the layout change of devise is not reflected
[Java] final override error is not displayed at compile time
Rails: When the image is no longer displayed using refile (the story was just fill → size)
What to do when Rails on Docker does not reflect controller changes in the browser
[Ubuntu 20.04] What to do if the external monitor is not recognized
[Rails] What to do if data is not registered in DB
What to do when the changes in the Servlet are not reflected
What to do if Cloud9 is full in the Rails tutorial
[Rails] About Uglifier :: Error: Unexpected token: at the time of deployment
[Rails] What to do when rails s does not respond or does not stop
What to do when "relation" hibernate_sequence "does not exist" in the ID column of PostgreSQL + JPA
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
[Rails carrier wave] How to not transition to the error screen even if the image upload is not selected
[Programming beginner] What to do when rails s becomes an error in the local development environment
How to solve the problem that the website image is not displayed after deploying to heroku on Rails 5
What to do about the "cannot be read or is not a valid ZIP file" error
What to do if the prefix c is not bound in JSP
[Rails] About the error when displaying the screen due to the autofocus of the form
What to do when "npm ERR! Code ENOSELF" is displayed after npm install
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
How to resolve the error'ActionView :: Template :: Error (The asset "application.css" is not present in the asset pipeline.'" When precompiling Rails assets
[Ruby] Meaning of &. How to avoid the error when the receiver (object) is nil
[Swift] What to do if the app icon is set but not reflected
What to do when is invalid because it does not start with a'-'
The devise error message is not displayed properly.
What to do when debugging "Source not found"
When the project is not displayed in eclipse
[JavaScript] I want to limit the processing by checking the input items when the specified time elapses at the time of focus out.
What to do if you get an error saying "Could not find a JavaScript runtime." When starting rails server
What to do if the update does not take effect after deploying Rails AWS
[Ruby on rails] When executing the heroku command, bash: heroku: command not found is displayed. [Rails tutorial]
What to do when routing settings do not work after building Docker environment with Laravel
Library not loaded when trying to upgrade the version of ruby and rails s
What to do if the breakpoint is shaded and does not stop during debugging
When the hover of Eclipse is hard to see
What to do if the Rails server can't start
What to do when The SSL certificate has expired
What to do when JSF tags do not become HTML
What to do when a null byte error occurs
What to do when rails creates a 〇〇 2.rb file
Error ExecJS :: RuntimeUnavailable: What to do when it occurs
[Error] The app is not displayed in the production environment