Reputation: 8493
I must be doing something silly. Any ideas on why this wouldn't be working. I get prompted to authenticate when making a request to the controller with the below config:
class ApplicationController < ActionController::Base
before_filter :auth, :except => [:aboutus]
The auth method is just this. It works fine but applies to all controllers including aboutus
#Simple HTTP Auth during development
def auth
authenticate_or_request_with_http_basic do |username, password|
username == "REDACTED" && password == "REDACTED"
end
end
Thanks
Upvotes: 1
Views: 1547
Reputation: 5357
This configuration would apply to the "aboutus" action of ApplicationController. Have you tried putting the before_filter definition in the controller that actually has the "aboutus" method/action?
You can put this in ApplicationController:
before_filter :auth
then, in the controller containing the aboutus method:
skip_before_filter :auth, :only => :aboutus
this way you don't repeat code and everything looks nice.
Upvotes: 3