constraints(constraints = {})
Instance Public methods
Parameter Restriction
Allows you to constrain the nested routes based on a set of rules. For
instance, in order to change the routes to allow for a dot character in the
id parameter:
constraints(id: /\d+\.\d+/) do
resources :posts
end
Now routes such as /posts/1 will no longer be valid, but
/posts/1.1 will be. The id parameter must match
the constraint passed in for this example.
You may use this to also restrict other parame