Rails custom css links are not working - following tutorial in http://ruby.railstutorial.org -



Rails custom css links are not working - following tutorial in http://ruby.railstutorial.org -

i'm new rails , working way tutorial here: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

i've added design css bundle public/stylesheets directory , added custom.css file cannot seem stylesheet load. understanding fo setup page should have bluish background , other little changes.

in app/views/layouts/application.html.erb file i've added next line:

<%= stylesheet_link_tag 'stylesheets/custom', :media => 'screen' %>

which believe should cause css /public/custom.css load.

in tutorial content of custom.css file located in section 5.1.2 (sorry i'm able post 2 hyperlinks here) . , content of app/views/layouts/application.html.erb file here:

http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:adding_to_the_layout

when view source on page there link custom.css file here:

but clicking brings "routing error - no route matches "/stylesheets/stylesheets/custom.css"" message.

as far can find i've followed tutorial i'm not sure wrong or i've missed. help on go here appreciated.

complete text of application.html.erb file:

<!doctype html> <html> <head> <title><%= title %></title> <%= csrf_meta_tag %> <!--[if lt ie 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %> <%= stylesheet_link_tag 'blueprint/print', :media => 'print' %> <!--[if lt ie 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]--> <%= stylesheet_link_tag 'custom', :media => 'screen' %> </head> <body> <div class="container"> <header> <%= image_tag("logo.png", :alt => "sample app", :class => "round") %> <nav class="round"> <ul> <li><%= link_to "home", '#' %></li> <li><%= link_to "help", '#' %></li> <li><%= link_to "sign in", '#' %></li> </ul> </nav> </header> <section class="round"> <%= yield %> </section> </div> </body> </html>

this still has same error when clicking custom.css link in source before:

"routing error - no route matches "/stylesheets/stylesheets/custom.css""

is happening on localhost or production environment? if it's production open config/production.rb , change:

config.serve_static_assets = false

to

config.serve_static_assets = true

if happening in development environment i'm wondering if perchance have more 1 layout file. check create sure don't have application.html.erb and application.html.haml. it's possible have separate layout posts, titled post.html.haml or something...

also

you state following:

which believe should cause css /public/custom.css load.

if custom.css file located in public/custom.css in wrong place, should in public/stylesheets/custom.css

edit:

below screenshot of app appears on machine, looks works ok after moving stylesheet right folder. took liberty of deleting public/index.html, can leave in until tutorial advises take out

ruby-on-rails css stylesheet

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -