I'm updating an old Rails (Ruby v 2.5.6 & Rails v 4.2.10) app and I've hit a weird error where when a user attempts to log in, if the password is incorrect I get
no implicit conversion of nil into Integer
on the line with
if @user_session.save
All the code is stock from authlogic so I can't understand why it's occurring
class UserSessionsController < BaseGUIController
include CurrentCart
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(user_session_params)
if @user_session.save
flash[:success] = "Welcome back!"
redirect_to root_url
else
render :new
end
end
private
def user_session_params
params.require(:user_session).permit(:email, :password, :remember_me)
end
end
It should return @user_session as not saved and redirect the user back to the login for to try again. If the password is correct there is no issue.
Am I missing something really obvious?
Thank you.