I am trying to figure out how to have persistent sessions (with like a
month until expiration) for my users, sort of like a “remember me”
functionality but that is handled automatically on login. I am hoping I
can get some help from someone who is more experienced with Rails.
I am currently using a controller called “Sessions” to handle my session
This is what my controller looks like.
@current_user = User.find_by_login_and_password(
if @current_user session[:user_id] = @current_user.id if session[:return_to] redirect_to session[:return_to] session[:return_to] = nil else redirect_to links_path end else render :action => 'new' end
session[:user_id] = @current_user = nil
I have surfed around the internet looking for solutions but their is no
real consistent method out there. Everyone seems to have a different
opinion on how to manage sessions/cookies. I am hoping to not have to
change my controller structure (by say installing a plug-in) and
sticking with Sessions creation.
Thank you in advance.