title: Playing multiple audio files rails' audio_tag: is there a way to play all the files from one player?
body: <p>I'm new to rails. I am building a site that has a function where the admin can upload audio files, that will then be played in the background.</p>
  
  <p>I am using carrierwave for file upload and rails' audio_tag for the player, but I am running into trouble when the database has more than one audio file.</p>
  
  <p>This is the relevant code from the view:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;%= audio_tag Track.pluck(:file), controls: true, autoplay: true %&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>which evaluates to: " &lt;%= audio_tag [file1, file2, file3...], controls: true, autoplay: true %></p>
  
  <p>(The .pluck method is extracting the file names from each track and storing them in an array of strings.)</p>
  
  
  
  <p>And my Track model (carrierwave uploader is called 'FileUploader'):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class Track &lt; ActiveRecord::Base
   validates :file, presence: true
   mount_uploader :file, FileUploader
  end</code></pre>
  </div>
  </div>
  </p>
  
  <p>The model is 'Track' with one attribute 'file.'</p>
  
  <p>How can I get the audio player to play multiple audio files, without pre-knowledge of what the file(s) will be?</p>
  
  <p>Thanks! </p>