Im trying to follow a tutorial online to set up an authentication system using LDAP active directory (have a VERY tough time). So the current error is:
undefined method `request_uri' for nil:NilClass
Referring to the following in my application controller:
def authenticate
unless session[:person]
session[:return_to] = @request.request_uri
redirect_to :controller => "login" , :action => "index"
return false
That part, I think, is supposed to save the url in an @request instance so that it can redirect the user there once he is logged in.
Is request_uri the wrong method? Any suggestions?
The problem isn’t the method being called. If you notice the error, the problem is you’re calling a method on nil. In other words, @request does not exist.
When accessing the request variable, it’s literally request, not @request.