This does the same as the previous code but is a little bit easier.
I removed the additional if, as you won't do anything if there is no user logged in.
In addition, I chained your function calls.
I give the User.current.logged? condition a higher priority,as this is essential to your call in Issue.watched_by?, the other condition will be only checked if there is a currently logged in user.
This does the same as the previous code but is a little bit easier. I removed the additional if, as you won't do anything if there is no user logged in. In addition, I chained your function calls.
I give the User.current.logged? condition a higher priority,as this is essential to your call in Issue.watched_by?, the other condition will be only checked if there is a currently logged in user.