Skip to content

Instantly share code, notes, and snippets.

@alterisian
Created September 14, 2011 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alterisian/1216430 to your computer and use it in GitHub Desktop.
Save alterisian/1216430 to your computer and use it in GitHub Desktop.
So that we can watch a random railscast.
class WatchController < ApplicationController
def index
max_cast = 222 #todo-fetchMaxCastNumber
base_url = "http://railscasts.com/episodes/"
options = "?autoplay=true"
random_cast = Random.rand(max_cast)
redirect_to base_url + random_cast.to_s + options
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment