title: CSS and JS not loading with two actions in one controller ruby on rails
body: <p>An index.html.erb page from index action in home controller loads fine with all the css and js linked in the view i.e .html.erb but when another action is called in the same page via 'link_to', all the js and css is lost. Even though the same links to css and js are available in the new action for ex: contact.html.erb view is called for the 'contact' action in home controller.</p>
  
  <p>How to use the css and js for all the actions in a controller? Sorry for the naivety as I have just started with RoR.</p>
  
  <pre><code>class HomeController &lt; ApplicationController
    def index
    end
  
    def contact
    end
  
    def generic
    end
  
    def elements
    end
  end
  
  
  &lt;!--"Application.html.erb"--&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;MiniProject&lt;/title&gt;
    &lt;%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' =&gt; true %&gt;
    &lt;%= javascript_include_tag 'application', 'data-turbolinks-track' =&gt; true %&gt;
    &lt;%= csrf_meta_tags %&gt;
    &lt;script src="js/ie/html5shiv.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="css/main.css" /&gt;
  &lt;link rel="stylesheet" href="css/ie8.css" /&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
  &lt;/head&gt;
  &lt;header id="header" class="alt"&gt;
                      &lt;h1&gt;&lt;a href="index.html"&gt;Make&lt;/a&gt;My Ride&lt;/h1&gt;
                      &lt;nav id="nav"&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;
                                  &lt;a href="#" class="icon fa-angle-down"&gt;Layouts&lt;/a&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;&lt;%= link_to "Generic", home_generic_path%&gt;&lt;/li&gt;
                                      &lt;li&gt;&lt;%= link_to "Contact", home_contact_path%&gt;&lt;/li&gt;
                                      &lt;li&gt;&lt;%= link_to "Elements", home_elements_path%&gt;&lt;/li&gt;
                                      &lt;li&gt;
                                          &lt;a href="#"&gt;Submenu&lt;/a&gt;
                                          &lt;ul&gt;
                                              &lt;li&gt;&lt;a href="#"&gt;Option One&lt;/a&gt;&lt;/li&gt;
                                              &lt;li&gt;&lt;a href="#"&gt;Option Two&lt;/a&gt;&lt;/li&gt;
                                              &lt;li&gt;&lt;a href="#"&gt;Option Three&lt;/a&gt;&lt;/li&gt;
                                              &lt;li&gt;&lt;a href="#"&gt;Option Four&lt;/a&gt;&lt;/li&gt;
                                          &lt;/ul&gt;
                                      &lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                              &lt;li&gt;&lt;a href="#" class="button"&gt;Sign Up&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/nav&gt;
                  &lt;/header&gt;
  
  
  &lt;body&gt;
  &lt;% if notice %&gt;
    &lt;p class="alert alert-success"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  &lt;% end %&gt;
  &lt;% if alert %&gt;
    &lt;p class="alert alert-danger"&gt;&lt;%= alert %&gt;&lt;/p&gt;
  &lt;% end %&gt;
  &lt;%= yield %&gt;
          &lt;!-- Scripts --&gt;
              &lt;script src="js/jquery.min.js"&gt;&lt;/script&gt;
              &lt;script src="js/jquery.dropotron.min.js"&gt;&lt;/script&gt;
              &lt;script src="js/jquery.scrollgress.min.js"&gt;&lt;/script&gt;
              &lt;script src="js/skel.min.js"&gt;&lt;/script&gt;
              &lt;script src="js/util.js"&gt;&lt;/script&gt;
              &lt;!--[if lte IE 8]&gt;&lt;script src="assets/js/ie/respond.min.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;
              &lt;script src="js/main.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
              &lt;!-- Footer --&gt;
                  &lt;footer id="footer"&gt;
                      &lt;ul class="icons"&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-twitter"&gt;&lt;span class="label"&gt;Twitter&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-facebook"&gt;&lt;span class="label"&gt;Facebook&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-instagram"&gt;&lt;span class="label"&gt;Instagram&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-github"&gt;&lt;span class="label"&gt;Github&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-dribbble"&gt;&lt;span class="label"&gt;Dribbble&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-google-plus"&gt;&lt;span class="label"&gt;Google+&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                      &lt;ul class="copyright"&gt;
                          &lt;li&gt;&amp;copy; Untitled. All rights reserved.&lt;/li&gt;&lt;li&gt;Design: &lt;a href="http://html5up.net"&gt;HTML5 UP&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/footer&gt;
  &lt;/html&gt;
  
  
  &lt;!--"Index.html.erb"--&gt;
      &lt;html&gt;
      &lt;body class="landing"&gt;
          &lt;div id="page-wrapper"&gt;
              &lt;!-- Banner --&gt;
                  &lt;section id="banner"&gt;
                      &lt;h2&gt;Alpha&lt;/h2&gt;
                      &lt;p&gt;Another fine responsive site template freebie by HTML5 UP.&lt;/p&gt;
                      &lt;ul class="actions"&gt;
                          &lt;li&gt;&lt;a href="#" class="button special"&gt;Sign Up&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="button"&gt;Learn More&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/section&gt;
  
              &lt;!-- Main --&gt;
                  &lt;section id="main" class="container"&gt;
  
                      &lt;section class="box special"&gt;
                          &lt;header class="major"&gt;
                              &lt;h2&gt;Introducing the ultimate mobile app
                              &lt;br /&gt;
                              for doing stuff with your phone&lt;/h2&gt;
                              &lt;p&gt;Blandit varius ut praesent nascetur eu penatibus nisi risus faucibus nunc ornare&lt;br /&gt;
                              adipiscing nunc adipiscing. Condimentum turpis massa.&lt;/p&gt;
                          &lt;/header&gt;
                          &lt;span class="image featured"&gt;&lt;img src="images/pic01.jpg" alt="" /&gt;&lt;/span&gt;
                      &lt;/section&gt;
  
                      &lt;section class="box special features"&gt;
                          &lt;div class="features-row"&gt;
                              &lt;section&gt;
                                  &lt;span class="icon major fa-bolt accent2"&gt;&lt;/span&gt;
                                  &lt;h3&gt;Magna etiam&lt;/h3&gt;
                                  &lt;p&gt;Integer volutpat ante et accumsan commophasellus sed aliquam feugiat lorem aliquet ut enim rutrum phasellus iaculis accumsan dolore magna aliquam veroeros.&lt;/p&gt;
                              &lt;/section&gt;
                              &lt;section&gt;
                                  &lt;span class="icon major fa-area-chart accent3"&gt;&lt;/span&gt;
                                  &lt;h3&gt;Ipsum dolor&lt;/h3&gt;
                                  &lt;p&gt;Integer volutpat ante et accumsan commophasellus sed aliquam feugiat lorem aliquet ut enim rutrum phasellus iaculis accumsan dolore magna aliquam veroeros.&lt;/p&gt;
                              &lt;/section&gt;
                          &lt;/div&gt;
                          &lt;div class="features-row"&gt;
                              &lt;section&gt;
                                  &lt;span class="icon major fa-cloud accent4"&gt;&lt;/span&gt;
                                  &lt;h3&gt;Sed feugiat&lt;/h3&gt;
                                  &lt;p&gt;Integer volutpat ante et accumsan commophasellus sed aliquam feugiat lorem aliquet ut enim rutrum phasellus iaculis accumsan dolore magna aliquam veroeros.&lt;/p&gt;
                              &lt;/section&gt;
                              &lt;section&gt;
                                  &lt;span class="icon major fa-lock accent5"&gt;&lt;/span&gt;
                                  &lt;h3&gt;Enim phasellus&lt;/h3&gt;
                                  &lt;p&gt;Integer volutpat ante et accumsan commophasellus sed aliquam feugiat lorem aliquet ut enim rutrum phasellus iaculis accumsan dolore magna aliquam veroeros.&lt;/p&gt;
                              &lt;/section&gt;
                          &lt;/div&gt;
                      &lt;/section&gt;
  
                      &lt;div class="row"&gt;
                          &lt;div class="6u 12u(narrower)"&gt;
  
                              &lt;section class="box special"&gt;
                                  &lt;span class="image featured"&gt;&lt;img src="images/pic02.jpg" alt="" /&gt;&lt;/span&gt;
                                  &lt;h3&gt;Sed lorem adipiscing&lt;/h3&gt;
                                  &lt;p&gt;Integer volutpat ante et accumsan commophasellus sed aliquam feugiat lorem aliquet ut enim rutrum phasellus iaculis accumsan dolore magna aliquam veroeros.&lt;/p&gt;
                                  &lt;ul class="actions"&gt;
                                      &lt;li&gt;&lt;a href="#" class="button alt"&gt;Learn More&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/section&gt;
  
                          &lt;/div&gt;
                          &lt;div class="6u 12u(narrower)"&gt;
  
                              &lt;section class="box special"&gt;
                                  &lt;span class="image featured"&gt;&lt;img src="images/pic03.jpg" alt="" /&gt;&lt;/span&gt;
                                  &lt;h3&gt;Accumsan integer&lt;/h3&gt;
                                  &lt;p&gt;Integer volutpat ante et accumsan commophasellus sed aliquam feugiat lorem aliquet ut enim rutrum phasellus iaculis accumsan dolore magna aliquam veroeros.&lt;/p&gt;
                                  &lt;ul class="actions"&gt;
                                      &lt;li&gt;&lt;a href="#" class="button alt"&gt;Learn More&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/section&gt;
  
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                  &lt;/section&gt;
  
              &lt;!-- CTA --&gt;
                  &lt;section id="cta"&gt;
  
                      &lt;h2&gt;Sign up for beta access&lt;/h2&gt;
                      &lt;p&gt;Blandit varius ut praesent nascetur eu penatibus nisi risus faucibus nunc.&lt;/p&gt;
  
                      &lt;form&gt;
                          &lt;div class="row uniform 50%"&gt;
                              &lt;div class="8u 12u(mobilep)"&gt;
                                  &lt;input type="email" name="email" id="email" placeholder="Email Address" /&gt;
                              &lt;/div&gt;
                              &lt;div class="4u 12u(mobilep)"&gt;
                                  &lt;input type="submit" value="Sign Up" class="fit" /&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
  
                  &lt;/section&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  
  
  
  &lt;!--"Contact.html.erb"--&gt;
  
  &lt;html&gt;
      &lt;body&gt;
          &lt;div id="page-wrapper"&gt;
  
              &lt;!-- Main --&gt;
                  &lt;section id="main" class="container 75%"&gt;
                      &lt;header&gt;
                          &lt;h2&gt;Contact Us&lt;/h2&gt;
                          &lt;p&gt;Tell us what you think about our little operation.&lt;/p&gt;
                      &lt;/header&gt;
                      &lt;div class="box"&gt;
                          &lt;form method="post" action="#"&gt;
                              &lt;div class="row uniform 50%"&gt;
                                  &lt;div class="6u 12u(mobilep)"&gt;
                                      &lt;input type="text" name="name" id="name" value="" placeholder="Name" /&gt;
                                  &lt;/div&gt;
                                  &lt;div class="6u 12u(mobilep)"&gt;
                                      &lt;input type="email" name="email" id="email" value="" placeholder="Email" /&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="row uniform 50%"&gt;
                                  &lt;div class="12u"&gt;
                                      &lt;input type="text" name="subject" id="subject" value="" placeholder="Subject" /&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="row uniform 50%"&gt;
                                  &lt;div class="12u"&gt;
                                      &lt;textarea name="message" id="message" placeholder="Enter your message" rows="6"&gt;&lt;/textarea&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="row uniform"&gt;
                                  &lt;div class="12u"&gt;
                                      &lt;ul class="actions align-center"&gt;
                                          &lt;li&gt;&lt;input type="submit" value="Send Message" /&gt;&lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/form&gt;
                      &lt;/div&gt;
                  &lt;/section&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>