You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to match a character like / or : in a route I can add a constraint block like so: get 'lib/:id' => 'catalog#show', constraints: { id: /ark:\/\d{5}\/f\w{7,9}/ }
This will match '/lib/ark:/99999/fk41234567' => { controller: 'catalog', action: 'show', id: 'ark:/99999/fk41234567' }
Now, I'd like to add an additional constraint of an object that responds to matches?
Tell us what happens instead ArgumentError: Invalid constraint
/Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:225:in `verify_callable_constraint': Invalid constraint: [#<AudioRoutingConcern:0x007fcf698a3f28>, {:id=>/ark:\/\d{5}\/f\w{7,9}/}] must respond to :call or :matches? (ArgumentError)
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:324:in `blocks'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:108:in `initialize'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:78:in `new'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:78:in `build'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:1560:in `add_route'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:1537:in `decomposed_match'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:1518:in `block in match'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:1508:in `each'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:1508:in `match'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:690:in `map_method'
from /Users/justin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/mapper.rb:651:in `get'
from /Users/justin/workspace/alexandria-v2/config/routes.rb:45:in `block in <top (required)>'
System configuration
Rails version: 4.5.1
Ruby version: 2.3.0
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not been commented on for at least
three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 5-0-stable branch or on master,
please reply with all of the information you have about it in order to keep the issue open.
This issue has been automatically closed because of inactivity.
If you can still reproduce this error on the 5-0-stable branch or on master,
please reply with all of the information you have about it in order to keep the issue open.
Steps to reproduce
In order to match a character like
/
or:
in a route I can add a constraint block like so:get 'lib/:id' => 'catalog#show', constraints: { id: /ark:\/\d{5}\/f\w{7,9}/ }
This will match
'/lib/ark:/99999/fk41234567' => { controller: 'catalog', action: 'show', id: 'ark:/99999/fk41234567' }
Now, I'd like to add an additional constraint of an object that responds to
matches?
However, now I've lost the ability to capture
/
in my id parameter.Expected behavior
It would be great if you could have multiple constraints like this:
Actual behavior
Tell us what happens instead
ArgumentError: Invalid constraint
System configuration
Rails version: 4.5.1
Ruby version: 2.3.0
The text was updated successfully, but these errors were encountered: