Skip to content

Instantly share code, notes, and snippets.

@remvee
Created March 5, 2010 10:27
Show Gist options
  • Save remvee/322623 to your computer and use it in GitHub Desktop.
Save remvee/322623 to your computer and use it in GitHub Desktop.
basic authentication for staging environment
class ApplicationController < ActionController::Base
helper :all
before_filter :authenticate if RAILS_ENV == 'staging'
private
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == STAGING_USERNAME && password == STAGING_PASSWORD
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment