Hello, I have the following if statement:
if !projectid_viewing.nil? && !user.role(projectid_viewing).nil? && user.role(projectid_viewing) == 'admin'
What I'm trying to do with the above, is not have the if break is projectid_viewing or user.role are nil. projectid_viewing seems to work great but user.role keeps breaking, giving the following error:
undefined method `role' for nil:NilClass
Can you help me with the if statement and is there a more elegant way to write the statement?