title: Gem usage: cocoon + selectize-rails
body: <p>I can't make <code>selectize-rails</code> work with <code>cocoon</code>. (When adding +1 attendance selectize is not active for it). I saw <a href="https://stackoverflow.com/questions/33070190/ruby-on-rails-selectize-js-with-cocoon">this</a> question, but it brought me nowhere.</p>
  
  <p>What I have:</p>
  
  <pre><code>- Attendance model
  - Event model
  - Event has_many :attendances
  </code></pre>
  
  <p>My js:</p>
  
  <pre><code>$(document).ready(function(){
      if ($('.selectize')){
          $('.selectize').selectize({
              sortField: 'text'
          });
      }
  });
  </code></pre>
  
  <p>Events/_form:</p>
  
  <pre><code>= simple_form_for @event do |f|
     = f.button :submit, class: "btn btn-success add-button"
     = f.input :starts_at, :minute_step =&gt; 15
    #tasks
      = f.simple_fields_for :attendances do |attendance|
        = render 'attendance_fields', f: attendance
      .links
        %p
        = link_to_add_association 'Add attendance', f, :attendances
  </code></pre>
  
  <p>_Attendance_fields:</p>
  
  <pre><code>.nested-fields
    = f.select :guest_id, Guest.all.map{|c| [c, c.id]}, {},class: 'selectize'
    = link_to_remove_association "Remove attendance", f
  </code></pre>
  
  <p>Any ideas? Please help</p>