Ruby on rails Authlogic openid:获取未定义的方法openid\u标识符?功能测试中的错误
我将Authlogic与Authlogic openid插件一起使用(我安装了ruby- openid和脚本/插件安装git://github.com/rails/open_id_authentication.git) 得到两个错误 首先,当运行功能测试时,我得到一个未定义的方法 openid_标识符?当 运行UsersControllerTest。电话是:Ruby on rails Authlogic openid:获取未定义的方法openid\u标识符?功能测试中的错误,ruby-on-rails,openid,authlogic,authlogic-oid,Ruby On Rails,Openid,Authlogic,Authlogic Oid,我将Authlogic与Authlogic openid插件一起使用(我安装了ruby- openid和脚本/插件安装git://github.com/rails/open_id_authentication.git) 得到两个错误 首先,当运行功能测试时,我得到一个未定义的方法 openid_标识符?当 运行UsersControllerTest。电话是: <% if @user.openid_identifier? %> 用户\控制器中的代码是直截了当的: def cr
<% if @user.openid_identifier? %>
用户\控制器中的代码是直截了当的:
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集以及bones GitHub项目的代码
但是什么也没找到
感谢您的帮助,usr您确定@user已设置吗?在我看来,问题在于@user是nil。问题在于authlogic\u oauth和authlogic\u openid插件被同时使用。这意味着用户上的save方法将由oauth代码的openid代码instaed处理
也许authlogic_rpx库可以成功地将这两种方法结合起来,我还需要对此进行测试 是的,我使用声明式授权,并且行过滤器\u资源\u访问位于users\u controller.rb的顶部。即使在保存之前添加@user=user.new(params[:user]),我也会得到相同的错误。我想这可能是因为我使用blogger作为openid提供者,但是如果我使用openid.org,我仍然会得到同样的错误。
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