if !row[0].include? 'Changed database' || !row[0].starts_with? '---' || !row[0].include? "rows affected" || !row[0].nil? || !row[0] == ""
if i do
if !row[0].include? 'Changed database'
it works well but if i do multiple conditions then it fails on this error
SyntaxError: /Users/tamer/Sites/active/app/models/account.rb:42: syntax error, unexpected tSTRING_BEG, expecting kTHEN or ':' or '\n' or ';'
...ase' || !row[0].starts_with? '---' || !row[0].include? "rows...
Sometimes the parser can’t guess at how you’re grouping arguments.
In your example, it’s interpreting
'Changed database' || !row[0].starts_with?as the argument passed toinclude?, and is choking when it comes across the next token,'---', which then makes no sense.Adding parentheses to clear up the ambiguity will solve the problem, e.g.:
If you really, really hate parentheses, you could also switch to using
orinstead of||, which has a weaker precedence and will be applied later, e.g.: