Ruby on rails 对于具有约束的路由,没有与[GET]匹配的路由

Ruby on rails 对于具有约束的路由,没有与[GET]匹配的路由,ruby-on-rails,ruby,ruby-on-rails-4,regex-lookarounds,Ruby On Rails,Ruby,Ruby On Rails 4,Regex Lookarounds,具有约束的管线没有管线错误。请在下面找到我的路线代码和我要匹配的字符串 路线: get '/product/:product_title', to: 'frontend_pages#product' , constraints: { product_title: /[A-Za-z0-9-]/ } 匹配字符串:www.mylink.com/product/this-is-the-Matching-String 如果有任何帮助,我将不胜感激。谢谢让我们看看定义路线中的约束部分。问题就在这

具有约束的管线没有管线错误。请在下面找到我的路线代码和我要匹配的字符串

路线:

get '/product/:product_title', to: 'frontend_pages#product' , 
    constraints: { product_title: /[A-Za-z0-9-]/ }
匹配字符串:www.mylink.com/product/this-is-the-Matching-String


如果有任何帮助,我将不胜感激。谢谢

让我们看看定义路线中的约束部分。问题就在这里


您编写的正则表达式失败 尝试一下:


希望这对你有帮助

constraints: { product_title: /[A-Za-z0-9-]/ }
product_title: /[A-Za-z0-9]+/