title: javascript not executed unless reloading page using turbolinks and rails 4
body: <p>I followed the <a href="http://railscasts.com/episodes/258-token-fields-revised?view=comments" rel="nofollow noreferrer">railscast tutorial</a> , but I found I can not load the "saved tokens".</p>
  
  <p>I think the problem is that when click 'edit' link (created by scaffold),</p>
  
  <p>it didn't trigger the preload function, how do you fix the problems in Rails 4</p>
  
  <p><img src="https://i.stack.imgur.com/QBIn3.png" alt="enter image description here">
  View page</p>
  
  <pre><code>  .form-inputs
      = f.input :name
      = f.input :content
      = f.text_field :user_tokens, data: {load: @article.users}
  </code></pre>
  
  <p>My coffeescript</p>
  
  <pre><code>$(document).ready -&gt; 
    $('#article_user_tokens').tokenInput '/users.json',
      theme: 'facebook',
      prePopulate: $('#article_user_tokens').data('load')
  </code></pre>
  
  <p>Require the css and js file</p>
  
  <pre><code> *= require token-input-facebook
   //= require jquery.tokeninput
  </code></pre>
  
  <p>I fix the bug by this solution, use the <code>ready page:load</code></p>
  
  <p>But I can not understand, why it works</p>
  
  <pre><code>$(document).on "ready page:load", -&gt;
    $('#article_user_tokens').tokenInput '/users.json',
      theme: 'facebook',
      prePopulate: $('#article_user_tokens').data('load')
  </code></pre>