2011-07-24 18 views
12

Rails 3.1 kullanan kullanıcılar authlogic'in hangi versiyonudur.Authlogic Rails 3.1

benim gemfile aşağıdaki girişine ulaşır:

gem 'authlogic', :git => 'https://github.com/AndreasWurm/authlogic.git' 

Ben sorun benim taban ApplicationController bir kod parçası ile olduğunu.

session[:return_to] = request.request_uri 

Şu hatayı alıyorum:

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 

alıyorum hata hattı ile

undefined method `request_uri' for #<ActionDispatch::Request:0x7dadd4d8> 

REQUEST_URI ActionDispatch kaldırıldı Has ve eğer öyleyse, ne Doğru alternatif mi?

cevap

7

fullpath size verecektir url (ama protokol, liman, alan olmadan) params ve request.url ile size fullpath atlama

30

iyi çözüm ActionDispatch yeni yöntemler kullanılarak, Vadim söylediği gibi her şeyi verecektir :: talep:

sadece değiştirin:

def store_location 
    session[:return_to] = request.request_uri 
end 

tarafından:

def store_location 
    session[:return_to] = request.url 
end 

ve iş bitti!

+0

Bu harika çalışıyor! Aferin Kzu. – Nizzy

İlgili konular