[RAILS] I want to display the images under assets/images in the production environment

In the local environment I can display the images under app/assets/images, but in the production environment, the images do not load properly. This seems to be because the path is different between the local and the production environment.

Local can display the image with the following code.

<%= image_tag hoge.png ", class:"hoge" %>

In a production environment, you need to use asset_path.

<%= image_tag asset_path("/images/hoge.png ", class:"hoge") %>

Recommended Posts

I want to display the images under assets/images in the production environment
Display the background image in the production environment
[Xcode] I want to manage images in folders
I want to get the value in Ruby
I want to display an error message when registering in the database
I want to embed any TraceId in the log
I want to display the name of the poster of the comment
[Rails] I want to display the link destination of link_to in a separate tab
I want to set the conditions to be displayed in collection_check_boxes
I want to recursively search the class list under the package
I want to transition to the same screen in the saved state
I want to narrow down the display of docker ps
I want to simplify the conditional if-else statement in Java
I want to control the display of the upper management navigation bar (Control menu) in Liferay 7 / DXP
I want to recreate the contents of assets from scratch in the environment built with capistrano
I want to remove the top margin in Grouped UITableView (swift)
[Java] I want to perform distinct with the key in the object
[Rails] How to reset the database in production environment (Capistrano version)
I want to change the value of Attribute in Selenium of Ruby
[Android] I want to get the listener from the button in ListView
How to reflect seeds.rb in production environment
I want to display background-ground-image on heroku.
I want to use @Autowired in Servlet
[Rails] Reset the database in the production environment
[Ruby] I want to output only the odd-numbered characters in the character string
I want to write JSP in Emacs more easily than the default.
I want to display images with REST Controller of Java and Spring!
[Ruby] I want to display posted items in order of newest date
I want to get the IP address when connecting to Wi-Fi in Java
I had to lower the PHP version in Docker + Composer + Laravel environment
[Rails + Webpacker] I want to use images of assets! Until you can view the image in Vue.js
I want to output the day of the week
I want to send an email in Java.
I tried to organize the session in Rails
I want to use arrow notation in Ruby
I want to var_dump the contents of the intent
I want to pass APP_HOME to logback in Gradle
rsync4j --I want to touch rsync in Java.
I want to be eventually even in kotlin
I want to truncate after the decimal point
(Capistrano) After deploying, I get a We're sorry… error in the production environment.
Development memo ~ I want to display only the first image posted multiple times ~
I want to create the strongest local development environment using VSCode Remote Containers
[Rails] I want to reset everything because the data in the local environment is strange! What to do before that
I was addicted to the NoSuchMethodError in Cloud Endpoints
I want to use Combine in UIKit as well.
I want to use Clojure's convenient functions in Kotlin
How to set the display time to Japan time in Rails
I tried to organize the cases used in programming
I want to do something like "cls" in Java
[Java] I want to calculate the difference from the date
Tokoro I rewrote in the migration from Wicket 7 to 8
I want to use fish shell in Laradock too! !!
For those who want to use MySQL for the database in the environment construction of Rails6 ~.
I want to use ES2015 in Java too! → (´ ・ ω ・ `)
I want to change the path after new registration after logging in with multiple devises.
I want to morphologically analyze the log in the DB and put it in the DB to classify messages 1
I want to judge the range using the monthly degree
I want to use a little icon in Rails
[Rails] How to delete production environment MySQL data after putting it in the development environment
I want to know the answer of the rock-paper-scissors app