title: Iterate over directory contents in rails view
body: <p>I'm trying to embed a slideshow into a website that I'm building using rails. This requires me to make an unordered list of images inside a rails view. The point is that:</p>
  
  <p>1) I want to have a directory, and have each image in the directory be included in the slideshow
  2) I don't want the directory contents to be read in every request (this slideshow will be in the layout, and will be visible in all pages)
  3) I want to be able to just drop a picture in the directory and the slideshow to pick it up</p>
  
  <p>I was thinking of simply using Dir.glob as in <a href="https://stackoverflow.com/questions/5804747/listing-linking-to-contents-of-directory-in-rails">this question</a>, but that violates requirement 2. </p>
  
  <p>Then I thought I could make a list of the files present at the time the site starts, and store it in the application controller. But that violates requirement 3. Or I could somehow update this list on the fly. </p>
  
  <p>Is there an easy way to do this? Am I making my life difficult for nothing? I mean I could just hard code the images. </p>