Ruby conditions + multiple ORs
Code refactoring for multiple OR conditions, Here is an example of weird looking conditional statement if name.blank? || surname.blank? || nickname.blank? || aka.blank? ... end Lets try and refactor this Option 1 if [name, surname, nickname, aka].any? { |field| field.blank? } ... end Option 2 if [name, surname, nickname, aka].any?(&:blank?) ... end