Skip to content

Instantly share code, notes, and snippets.

@djbender
Created July 8, 2013 22:14
Show Gist options
  • Save djbender/5952946 to your computer and use it in GitHub Desktop.
Save djbender/5952946 to your computer and use it in GitHub Desktop.
http_basic_authenticate_with
class PostsController < ApplicationController
http_basic_authenticate_with name: "dhh", password: "secret", except: :index
def index
render text: "Everyone can see me!"
end
def edit
render text: "I'm only accessible if you know the password"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment