I am using some code that uses this syntax (restful authentication).
def logged_in?
!!current_user()
end
Tried googling for this but it just seems to ignore “!!”, will accept an answer that can tell me how to find info about searching for strings such as !! in google.
It’s double negation. The first
!converts it tofalseifcurrent_useris notnilorfalse. After that it converts it totrue. So the result is always a boolean value and not the value ofcurrent_user. The result is alwaystrueifcurrent_useris notfalseornil. Otherwise it’sfalse.