While watching the video of Ruby on Rails application production on YouTube, I will summarize it as a record because the title error occurred while learning in the local environment.
When implementing the logout function
ActionView::Template::Error: The asset "application.js" is not present in the asset pipeline
And a javascript file does not exist error occurred.
Upon examination, the cause was a different version of rails.
On the video, the development environment is rails: 5.2.4.1
, and the Javascript folder is
app/assets/javascripts/application.js
But in rails 6
app/javascripts/application.js
The place was different.
In the view file head in ails 5.x
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
Since it is, I changed it as follows so that application.js can be loaded normally and solved it.
application.html.erb
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
Since it was the first application production in the local environment, I didn't understand anything and executed rails new [project name]
according to the video, and started with the latest version.
Recommended Posts