How to have multiple constraints in Rails routes.rb?

ruby-on-rails, ruby-on-rails-3

Solution

I guess you will have to make a custom constraints class and put all your constraints there. Refer the advanced constraints in rails guides(Link below) for more information.

http://guides.rubyonrails.org/routing.html#advanced-constraints

Problem

I would like a rails route that takes 2 constraints into consideration. How can this be done? The two constraints ``` match ':id' => 'pages#temp', :constraints => { :uuid => /[A-Za-z\d]([-\w]{,498}[A-Za-z\d])?/ } root :to => 'pages#temp', :constraints => lambda {|r| r.env["warden"].authenticate? } ``` How can I have one route like so with both of the constraints in place? Thanks ``` match ':id' => 'pages#temp', :constraints => ```

Original source