mercredi 20 janvier 2016

PHP to Ruby (on Rails)

I'm trying to learn Ruby on Rails. How could I make a simple PHP random page code like this in RoR?

$urls = array (
    "1.html",
    "2.html",
    "3.html",
    "4.html",
);
$random = mt_rand(0, count($urls) - 1);
header ("Location: ".$urls[$random]);
exit;




Aucun commentaire:

Enregistrer un commentaire