Authlogic-openidアドオン(ruby-openidとscript / pluginインストールgit://github.com/rails/open_id_authentication.gitをgemでインストール)でAuthlogicを使用すると、2つのエラーが発生します。
最初に機能テストを実行すると、未定義のメソッドopenid_identifierを取得しますか?UsersControllerTestを実行しているときに、new.html.erbファイルの行にメッセージが表示されます。行は次のとおりです。
<% if @user.openid_identifier? %>
スクリプト/コンソールを実行しているとき、問題なくこのメソッドにアクセスできます。
次に、openid機能をテストし、openidを使用して新しいユーザーをアプリケーションに登録し、そのために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 do | result|..であるというエラーを与える行
かなり基本的なものが欠けているように感じますが、それが何であるかがわからないため、長い間これを見つめてきました。Railscastsのエピソード160と170、およびボーンのGitHubプロジェクトのコードを確認しましたが、何も見つかりませんでした。
あなたの助けをありがとう、usr