Skip to content

Instantly share code, notes, and snippets.

@jamesgecko
Created April 28, 2011 16:09
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 jamesgecko/946663 to your computer and use it in GitHub Desktop.
Save jamesgecko/946663 to your computer and use it in GitHub Desktop.
In which James learns that redirect_to is not instant.
class SessionController < ApplicationController
def index_attempt_one
if !session[:unset_key]
redirect_to :action => 'login'
end
# Anything here gets executed too! D-:
end
def index_attempt_two
if !session[:unset_key]
redirect_to :action => 'login'
else
# Now we are safe. -_-
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment