Nathan Witmer
11/11/2006 1:12:00 AM
It's a little unclear, but it sounds like you're looking for an
exclusive or. Looks like the bitwise XOR operator works on
expressions, not just bits:
false ^ false # => false
false ^ true # => true
true ^ false # => true
true ^ true # => false
(1==1) ^ (1==2) # => true
So you should be able to do:
if (@unit.custodian_id == session[:person_id]) ^
(session[:person_role] == 'admin')