Kirkos Kirkos - 28 days ago 13
CSS Question

ActionController::RoutingError (No route matches [GET] "/assets/javascripts

I am running a development server and I'm trying to load some static pages and files (images, css and javasripts) in my rails application for testing. (In general, I'm new in rails. The Rails installation has been done on Linux subsystem in Windows 10).
Although I have placed the files in

assets/images
,
assets/javascripts
and
assets/stylesheets
I couldn't manage to read these files in my test apprication when server runs. I receive the following errors almost for all files I have added:

ActionController::RoutingError (No route matches [GET] "/assets/javascripts/jquery.min.js"):

ActionController::RoutingError (No route matches [GET] "/assets/javascripts/bootstrap.min.js"):

ActionController::RoutingError (No route matches [GET] "/assets/javascripts/jqBootstrapValidation.js"):


and for images

ActionController::RoutingError (No route matches [GET] "/assets/images/portfolio/dreams-preview.png"):


The same applies for some css files also (not all).

I tried several ideas I found here in order to solve this but I had no luck.
I tried to setup:

config.serve_static_files = true


in
development.rb
and

rake assets:precompile


Obviously, these files are not visible by rails application but I still don't understand what I have to do to make them visible. Can you please help me on this?

Answer

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.