public
Created

An example of how we check to see if the current visitor is allowed to see the beta running in production.

  • Download Gist
application_controller.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
class ApplicationController < ActionController::Base
 
protect_from_forgery
before_filter :check_beta, :except => [ :beta ]
 
def beta
render :layout => "blank"
end
 
protected
 
def check_beta
is_in_beta = true
if Rails.env == "production"
if params[:show_me_the_beta] == "true"
session[:see_beta] = true
end
 
if !session[:see_beta]
redirect_to beta_path
end
end
end
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.