Authlogic-openid addon (Authlogic이 설치된 gem : ruby- openid 및 script/plugin install git : //github.com/rails/open_id_authentication.git)과 함께 Authlogic을 사용하고 두 가지 오류가 발생합니다.Authlogic openid : 정의되지 않은 메소드 가져 오기 openid_identifier? 기능 테스트에서 오류가 발생했습니다.
처음 기능 테스트를 실행할 때 정의되지 않은 메서드가 나타납니다. openid_identifier? UsersControllerTest를 실행하는 일 때 내 new.html.erb 파일의 한 줄에 라인은 다음과 같습니다 스크립트/콘솔을 실행하는 경우
<% if @user.openid_identifier? %>
나는 어떤 문제없이이 방법에 액세스 할 수 있습니다.
둘째, 오픈 ID 기능을 테스트하고 오픈 ID를 사용하여 내 응용 프로그램에 새 사용자를 등록하고 나는 내 로그 파일에 다음과 얻을 내 Blogspot의 계정을 사용하는 경우 :
Generated checkid_setup request to http://www.blogger.com/openid-server.g
with assocication ...
Redirected to http://www.blogger.com/openid-server.g?openid.assoc_handle=...
NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.call):
app/controllers/users_controller.rb:44:in `create'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
users_controller의 코드 정직 :
def create
respond_to do |format|
@user.save do |result|
if result
flash[:notice] = t('Thanks for signing up!')
format.html { redirect_to :action => 'index' }
format.xml { render :xml => @user, :status => :created, :location => @user }
else
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end
end
user.save 할 @ 오류 인을 제공 라인 | 결과 | ...
,나는 아주 기본적인 것을 놓치고 있다고 느낀다. 그러나 나는 그것이 무엇인지를 찾을 수 없기 때문에 너무 오랫동안 을 쳐다보고 있었다. Railscasts 에피소드 160과 170의 코드와 GitHub 프로젝트 뼈를 확인했지만 아무 것도 발견되지 않았습니다.
예, 내가 선언적 승인 및 filter_resource_access 이 users_controller.rb의 상단에있는 줄을 사용합니다. 내가 추가하더라도, 사용자가 User.new (params [: user]) 저장하기 전에 동일한 오류가 발생합니다. 블로거를 openid provider로 사용한다고 생각했지만 openid.org를 사용하면 여전히 같은 오류가 발생합니다. –