Rails Ruby

File: app\controllers\hello_controller.rb
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
File: app\views\hello\show.rhtml


Random Image


Random Image


Displaying image <%= @random_image%>
">


 
randomImage.zip( 88 k)