Ruby has a safe operator, no need to try anymore
Wow, how did I miss this memo? Ruby 2.3 introduced a safe operator
Instead of
current_user.try(:profile).try(:bio)
you can now do
current_user&.profile&.bio
Wow, how did I miss this memo? Ruby 2.3 introduced a safe operator
Instead of
current_user.try(:profile).try(:bio)
you can now do
current_user&.profile&.bio