class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  before_action :basic_authorization

  private

  def basic_authorization
    authenticate_or_request_with_http_basic do |user, pass|
      user == ENV['USER_ID'] && pass == ENV['USER_PASS']
    end
  end
end

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  before_action :basic_authorization, unless: -> { Rails.env.development? }

  private

  def basic_authorization
    authenticate_or_request_with_http_basic do |user, pass|
      user == ENV['USER_ID'] && pass == ENV['USER_PASS']
    end
  end
end

Disable basic authentication only development environment
Disable basic authentication only development environment
