Rails 显示随机图片 2015/08/11 15172 class HelloController < ApplicationController def show @images = ["image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg"] @random_no = rand(5) @random_image = @images[@random_no] end end