title: GET http://localhost:3000/projects/assets/jquery.masonry.js 404 (Not Found)
body: <p>I was trying to add a javascript-plugin masonry to my rails app and was wondering why it would only work for my welcome controller (localhost:3000/) but not for other controllers as localhost:3000/projects/1, although I'm using exactly the identical code.</p>
  <p>I get this error:</p>
  <blockquote>
  <p>GET localhost:3000/projects/assets/jquery.masonry.js 404 (Not Found)</p>
  </blockquote>
  <p>and</p>
  <blockquote>
  <p>Uncaught TypeError: Object [object Object] has no method 'masonry'</p>
  <p>(anonymous function)</p>
  <p>e.resolveWith jquery.min.js</p>
  <p>e.extend.ready jquery.min.js</p>
  <p>c.addEventListener.z</p>
  </blockquote>
  <p>I asume I get the error because of the wrong path localhost/projects/assets instead of localhost/assets, but I couldn't find out how to fix this.
  Any help would be welcome!</p>
  <p>This is the code in the view:</p>
  <pre><code>&lt;% content_for(:scripts) do %&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
      
    $(function(){
      $('.squarescontainer').masonry({
        // options
        itemSelector : '.item',
        isAnimated: true
      });
    });
      
  &lt;/script&gt;
  &lt;% end %&gt;
  </code></pre>
  <p>and this is my application.rb:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;ifub&lt;/title&gt;
      &lt;%= stylesheet_link_tag    &quot;application&quot;, :media =&gt; &quot;all&quot; %&gt;
      &lt;%= javascript_include_tag &quot;application&quot; %&gt;
      &lt;%= csrf_meta_tags %&gt;
      &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;http://fonts.googleapis.com/css?family=PT+Sans+Narrow&amp;v1&quot;&gt;
      &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;http://fonts.googleapis.com/css?family=Oswald&quot;&gt;
    
      &lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot;&gt;&lt;/script&gt;
    
      &lt;script src = &quot;assets/jquery.masonry.js&quot;&gt;&lt;/script&gt;
      &lt;script src = &quot;assets/jquery.masonry.min.js&quot;&gt;&lt;/script&gt;
  
      &lt;%= yield(:head) %&gt;
      
    &lt;/head&gt;
    
    &lt;body&gt;
      &lt;%= render 'layouts/logo' %&gt;
      
      &lt;p class=&quot;notice&quot;&gt;&lt;%= notice %&gt;&lt;/p&gt;
        &lt;p class=&quot;alert&quot;&gt;&lt;%= alert %&gt;&lt;/p&gt;
    
      &lt;div class=&quot;frame&quot;&gt;
        &lt;div class=&quot;container&quot;&gt;
          &lt;%= yield %&gt;
          &lt;%= yield :scripts %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Thanks for your help!</p>