Rails 3 Routing Constraint and Regex
I'm looking to match the pattern state/city in the path, unless the state variable equals "auth" match '/:state/:city' => 'cities#index', :as => :state_cities, :constraints => {:state => /(?!auth)/ } For example, mydomain.com/fl/miami is good. mydomain.com/auth/twitter is bad. I am using omniauth and it requires that you go to /auth/twitter for authentication, however it is nowhere to be found when I type rake routes . Based on mu is too short's comments, here is the answer I've come up with: match '/:state/:city' => 'cities#index', :as => :state_cities, :constraints => OmniauthPassThru.new