2017-09-11 94 views
0

我要創建其中任一值是接受了路線,我創建了一個這樣的正則表達式中的Rails路由

get '/coworking-in-:coworking_place', to: 'home#coworking', constraints: { :coworking_place => /[a-z]*[A-Z]*/ }

這是工作的罰款有以下情況:

  1. WWW。 aboardoffices.com/coworking-in-delhi
  2. www.aboardoffices.com/coworking-in-mumbai

但它不是在下列情況下工作:

  1. www.aboardoffices.com/coworking-in-sector7Dwarka
  2. www.aboardoffices.com/coworking-in-dlfPhase1Gurgaon

我想要創建可接受任何參數的路線:coworking_place

回答