Question

I am using rails 4 and comfortable mexican sofa. I wish to secure some cms pages with password protection. They don't need to be very secure. The following code gives me an undefined method error:

module CmsPagesAuth

  def authenticate
    http_basic_authenticate_with name: "dhh", password: "secret"
  end
end

the method is part of ActionController::HttpAuthentication::Basic How to I get access to the method in question? Or is there a better way I should be going about this problem? Thanks in advance for any suggestions, solutions or insights.

Was it helpful?

Solution

class StaticController < ApplicationController
   http_basic_authenticate_with name: "dhh", password: "secret", only: [your static actions]
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top