Skip to content

Commit 120f06e

Browse files
committed
Allow custom constraints on jsonapi_resources routes.
1 parent 2d7e38b commit 120f06e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/jsonapi/routing_ext.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def jsonapi_resources(*resources, &_block)
6969
options[:path] = format_route(@resource_type)
7070

7171
if res.resource_key_type == :uuid
72-
options[:constraints] = {id: /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/}
72+
options[:constraints] ||= {}
73+
options[:constraints][:id] ||= /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/
7374
end
7475

7576
if options[:except]

0 commit comments

Comments
 (0)