I have a gifs folder inside the images folder. The gifs folder has a list of gifs
app/assets/images/gifs
I want to get the length of this gifs folder (how many gifs are in this folder) so that I can randomly render a gif
<%= image_tag "thank_you_gifs/#{rand(***gifs.length***)}.gif", width: "370" %>
I don't want to hard code the length because gifs are periodically added to the gifs folder.
Thanks!
Aucun commentaire:
Enregistrer un commentaire