How to check status of invitation?

684 Views Asked by At

For each User I want to display his invitation status: "Invitation Sent" or "Invitation Accepted"

Currently I just check if a field encrypted_password in Users table contains anything. If it is not - then a user did not registered (accepted an invitation) yet but it was sent to him (otherwise this user's record would not exist in DB)

Is there a more elegant way to do it?

1

There are 1 best solutions below

0
SSR On BEST ANSWER

Yes you should take a

is_registered:boolean

column in user table which contains default value "false". Now you just have to do is when user get registered that time you just change value to "true". when ever you want to check is user registered? just do

@user.is_registered? or current_user.is_registered?

this returns true/false