Skip to content

Instantly share code, notes, and snippets.

@chadwtaylor
Last active December 23, 2015 23:09
Show Gist options
  • Save chadwtaylor/6708300 to your computer and use it in GitHub Desktop.
Save chadwtaylor/6708300 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
# Need a way to use :except to ignore a specific controller (ie: MessagesController)
before_filter :authenticate, :except => ["index"]
private
def authenticate
authenticate_or_request_with_http_basic('Administration') do |username, password|
username == 'admin' && password == 'password'
end
end
end
class MessagesController < ApplicationController
# this controller should not require HTTP Authentication
skip_before_filter :authenticate
def messages_inbound
# do stuff here
end
end
@foucist
Copy link

foucist commented Sep 26, 2013

you might need to change that to this:

def authenticate
authenticate_or_request_with_http_basic('Administration') do |username, password|
username == 'admin' && password == 'password'
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment