0

私はいくつかの奇妙な問題を抱えています:私が実行した場合

class ApplicationController < ActionController::Base
    http_basic_authenticate_with name: "test", password: "test"

それは正常に動作します。でもこれ入れたら

before_filter authenticate_incoming

  def authenticate_incoming
    http_basic_authenticate_with name: "hi", password: "ho"
  end

私は得るundefined method http_basic_authenticate_with。どこが間違っていますか?

4

2 に答える 2

0

http_basic_authenticate_withはクラス メソッドでauthenticate_incomingあり、インスタンス メソッドです。できますself.class.http_basic_authenticate_withが、それを a で行うのはあまり意味がありませんbefore_filter。あなたの目標は何ですか?それを達成する方法を考えるお手伝いができるかもしれません。

于 2013-11-14T20:11:05.867 に答える