Actioncontroller::routingerror (no Route Matches [get] "/assets/javascripts
Solution 1:
You need to include these files in application.js manully or just write //= require_tree .
to load all js
Similarly, you have to work for css. Add *= require_tree .
in application.css
.
Solution 2:
Finally, in order to resolve this error and transfer my static pages to Rails I had to modify my homepage.html.erb
as follows:
Stylesheet links:
<%= stylesheet_link_tag "bootstrap.min.css" %>
the following also works:
<link href="assets/bootstrap.min.css" rel="stylesheet">
Javascript include:
<%= javascript_include_tag "bootstrap.min.js" %>
In general, I found that no precompilation is necessary. I tested and it works with or without precompilation. The following also works:
<scriptsrc="assets/bootstrap.min.js"></script>
Tag for images:
<%= image_tag("portfolio/dreams-preview.png", class: "img-responsive img-centered") %>
Rails use by default the normal path for images (assets/images
). The full path should not be used. Unless the path for images is different, use only the path deeper than assets/images
, if exists.
No changes were made in application.html.erb
but precompilation for javascripts and stylesheets is necessary in assets.rb
:
Rails.application.config.assets.precompile += ['agency.min.js', 'agency.min.css', ...]
Eventually the site works, although some conflicts in the execution of javascripts might be appear.
Solution 3:
I was actually getting these kind of errors too. Mine looked like this:
F, [2018-06-16T17:46:02.121588 #6963] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/assets/theme/bootstrap.min.css"):
[2018-06-18T12:55:20.169664 #18951] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/assets/theme/main.css"):
And I never added any reference to these files in my application. So I did not immediately realize why these specific css files were being requested. Well, it happens that after my application received a 404 error or 500 error, it would load the corresponding 404.html or 500.html in the public directory. Those directories did reference these css files:
<head><title>PAGE NOT FOUND (404)</title><metaname="viewport"content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"><linkrel="stylesheet"href="/assets/theme/bootstrap.min.css"><linkrel="stylesheet"href="/assets/theme/main.css"></head>
So remove the references here and errors will go away.
Post a Comment for "Actioncontroller::routingerror (no Route Matches [get] "/assets/javascripts"