2
一旦我将cancan Gem添加到我的authlogic授权系统中,我开始遇到问题。我的link_to编辑当前用户配置文件已死!cancan authlogic gem's编辑当前用户配置文件错误
代码:
#application.html.erb
<%= link_to "Edit Profile", edit_user_path(:current) %>
#ApplicationController
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.record
end
rescue_from CanCan::AccessDenied do |exception|
flash[:error] = "Access denied."
redirect_to root_url
end
error:
ActiveRecord::RecordNotFound in UsersController#edit
Couldn't find User with ID=current
我已经尝试了许多方法来获得当前用户ID的修改链接没有什么作品有没有人有什么想法?
问候
丹
也许Rails不知道什么是':current'符号?你也可以从'UsersController'添加一些代码,因为它说错误在这个控制器中。 – klew 2010-02-28 18:29:04