- if flash && (flash[:error] || flash[:notice])
  .flash
    - if flash && flash[:error] && !flash[:error].empty?
      .message.error
        %p= flash[:error]

    - if flash && flash[:notice] && !flash[:notice].empty?
      .message.notice
        %p= flash[:notice]

- if flash && (flash[:error] || flash[:notice])
  .flash
    - if flash && flash[:error].present?
      .message.error
        %p= flash[:error]

    - if flash && flash[:notice].present?
      .message.notice
        %p= flash[:notice]

Use .present? instead of .empty?
Use .present? instead of .empty?
