title: Materializecss menu works fine only on one page
body: <p>I'm using <code>materialize-sass</code> gem in my Rails app and have some troubles with using it. It works fine only in root (home) page, and in some others but not on full site.</p>
  
  <p>The <code>.button-collapse</code> losts functionality and menu doesn't work. I just click on it, or tap (in mobile device) and nothing happens. Sometimes it works after page refresh, sometimes don't. Always after clicking on <code>.button-collapse</code> to the url adds <code>#!</code> in the end (it's logically understandable), except the root (home) page.
  I think it might be the jQuery problem, but I initialize collapse button in <code>assets/javascripts/application.js</code>, as:</p>
  
  <pre><code>$(function() {
    $(".button-collapse").sideNav();
  });
  </code></pre>
  
  <p>like in official guide. Also I'm trying to use <code>document.ready</code>. All my related code located in <code>application.html.erb</code> and looks like this:</p>
  
  <pre><code>    &lt;header&gt;
        &lt;div class="row"&gt;
          &lt;nav class="col s12 nav-wrapper"&gt;
            &lt;%= link_to 'Blog', root_path, class: 'brand-logo' %&gt;
            &lt;a href="#!" data-activates="mobile-demo" class="button-collapse"&gt;&lt;i class="material-icons"&gt;menu&lt;/i&gt;&lt;/a&gt;
            &lt;ul class="right hide-on-med-and-down"&gt;
              &lt;% if user_signed_in? %&gt;
                &lt;li&gt;
                  &lt;%= "Hello, #{current_user.username}" %&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;%= link_to 'Sign out', destroy_user_session_path, method: :delete %&gt;
                &lt;/li&gt;
              &lt;% else %&gt;
                &lt;li&gt;
                  &lt;%= link_to 'Sign in', new_user_session_path %&gt;
                &lt;/li&gt;
                &lt;% end %&gt;
            &lt;/ul&gt;
            &lt;ul class="side-nav" id="mobile-demo"&gt;
              &lt;% if user_signed_in? %&gt;
                &lt;li&gt;
                  &lt;%= "Hello, #{current_user.username}" %&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;%= link_to 'Sign out', destroy_user_session_path, method: :delete %&gt;
                &lt;/li&gt;
              &lt;% else %&gt;
                &lt;li&gt;
                  &lt;%= link_to 'Sign in', new_user_session_path %&gt;
                &lt;/li&gt;
              &lt;% end %&gt;
            &lt;/ul&gt;
          &lt;/nav&gt;
        &lt;/div&gt;
      &lt;/header&gt;
  </code></pre>