correct if statement for alerts in application.erb