Here is my UserService class, once my route get the singup request, it will call UserService.singup to do the signup logic. I want to save user's id in session but it just dosen't work.
It keep showing me "NameError - undefined local variable or method `session' for UserService:Class"
class UserService
def self.signup(params)
@user = User.new(params)
if @user.save
session[:user_id] = @user.id
make_json(200, 0, "Signup success!", @user)
else
make_json(400, 0, "Signup success!")
end
end
end
Aucun commentaire:
Enregistrer un commentaire