How about  <% if !prefix.nil? and !prefix.empty? and prefix != "/" %>   instead? Seems more explicit.