Rails layout working for root only

So, I’m learning to build Rails app, I’ve written the controller and everything looks fine, then moved to get the views.
As usual I downloaded a template and started to move it into my app (normal html template from html5up.net).

All JS files I’ve put them in app/assets/javascripts.

All CSS files I’ve put them in the app/assets/stylesheets.

and in the app/views/layouts/application.html.erb I’ve included them all using the javascript_include_tag and stylesheet_link_tag
so everything in theory should be fine.

In my routes file I got those 2 lines:

resources :users
root 'users#new'

When I start the server and go to the root route localhost:3000 everything is rendered smoothly and with awesome style, however if I try to access the very same page but from it’s original route localhost:3000/users/new somewhy the html I get doesn’t include images and scripts, and the style is messed up (probably because no images/js), same goes for other pages from the users controller.
I tried putting the js/css files in public folder and linking to them but it gives exact same results.
Any idea what’s going wrong and how to fix it?

I’m using Rails 4.2.1


Source: ruby

Leave a Reply