Which version of authlogic are people using with Rails 3.1.
I have the following entry in my gemfile:
gem 'authlogic', :git => 'https://github.com/AndreasWurm/authlogic.git'
The problem I have is with a piece of code in my base 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
The error I am getting is with the line:
session[:return_to] = request.request_uri
I am getting an error saying:
undefined method `request_uri' for #<ActionDispatch::Request:0x7dadd4d8>
Has Request_uri been removed from ActionDispatch and if so, what is the correct alternative?
The best solution is as said Vadim, using the new methods in ActionDispatch::Request :
You just replace :
def store_location
session[:return_to] = request.request_uri
end
by :
def store_location
session[:return_to] = request.url
end
and it's done !
fullpath will give you url(but without protocol, port, domain) with params
and request.url
will give you everything that fullpath
skips
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With