我希望在模型中做类似于这样的事情,使用公共文件夹作为文件数据库。
有没有办法让Rails以这种方式“看到”public目录中的文件?
all_images = []
(1..100).each do |image_number|
if File.exists?("/img/#{image_number}.jpg")
# add image path to the list
end
end
有没有办法让Rails以这种方式“看到”public目录中的文件?