storing username in ruby using session and database serious problem
I have been tearing my hair out for the last 24 hours, all I am really trying to do is simple. A user has an edit page where they can edit thier details, but before I can do this I need to retrieve the student unique identifier (k_number) is my database primary key in the student database.
def edit
@title = "Edit Your Details"
@user_id = session["user_id"]
@current_user = Student.find_by_k_number(session["user_id"])
end
Its just not working, when I开发者_高级运维 look at the backend query, the k_number is being passed as null. Please help
Perhaps:
@current_user = Student.find_by_k_number(params[:user_id])
精彩评论