使用切片从元标记描述中删除 "The"

Using slice to remove "The" from meta tag description

我有一个元标记描述,我想在其中获取授权名称。然而,许多资助名称以 The like "The Smithsonian Grant" 开头。我希望我的元标记显示 "Apply online to the Smithsonian Grant" 而不是 "the The Smithsonian Grant"。如果是 "The",我将如何删除授权名称的第一个单词?

我试过这个:

<% meta_description "Apply online to the #{@grant.name.slice("The")} on Instrumentl" %>

但结果是

<meta name="description" content="Apply online to the The on Instrumentl" />

这不是我期望的 slice 工作方式。我还尝试了 .slice!、.reduce 和 .except 代替 .slice,但其中 none 有效。有什么想法吗?

我会使用 gsub,它将用替换字符串替换匹配字符串的任何部分。如果替换字符串为空,它将完全删除匹配的字符串:

>> "The Smithsonian Grant".gsub(/^the */i, "")
=> "Smithsonian Grant"

>> "Winnie the pooh".gsub(/^the */i, "")
=> "Winnie the pooh"