人们使用Rails 3.1版本的authlogic.
我的gemfile中有以下条目:
gem 'authlogic',:git => 'https://github.com/AndreasWurm/authlogic.git'
我的问题是在我的基础ApplicationController中的一段代码.
def require_no_user if current_user store_location flash[:notice] = "You must be logged out to access this page" redirect_to :controller => "home",:action => "index" return false end end def store_location session[:return_to] = request.request_uri end
我得到的错误是:
session[:return_to] = request.request_uri
我得到一个错误说:
undefined method `request_uri' for #<ActionDispatch::Request:0x7dadd4d8>
请求_uri已从ActionDispatch中删除,如果是,是什么正确的替代方法?
解决方法
最好的解决方案就是说
Vadim,使用ActionDispatch :: Request中的新方法:
你只是替换:
def store_location session[:return_to] = request.request_uri end
通过:
def store_location session[:return_to] = request.url end
完成了!