I have an if statement in my Rails app. I need to do a basic "if true and !false" sort of check. The expression is defined as:
ActiveRecord::Base.connection.tables.include? 'settings' && !Settings.setting_is_set?('defaults_set')
If I put that as my expression to an if, the if will not trigger. If I run that expression in the console, I get false.
Now, if I modify the expression to read:
ActiveRecord::Base.connection.tables.include? 'settings' and not Settings.setting_is_set?('defaults_set')
It returns true as it should, and the executes it's block.
So the question is: Why is 'expression && !expression' not behaving like 'expression and not expression'. It's my understanding && and ! should correspond to and and not almost directly.
What am I missing here?