Skip to content

Commit a158769

Browse files
Merge pull request #40 from langsamu/master
Schema routing
2 parents c61aba4 + 0f8daaf commit a158769

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/lib/ext/action_dispatch/routing/mapper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Routing
33
class Mapper
44
# Mapper class provides methods for routes.rb
55
ID_FORMAT_REGEX = /\w{8}/
6+
ID_OR_SCHEMA_FORMAT_REGEX = /\w{8}|schema\/\w+/
67

78
# @since 0.0.1
89
# Creates routes for listables

config/routes.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
Rails.application.routes.draw do
99
id_format_regex = self.class::ID_FORMAT_REGEX
10+
id_or_schema_format_regex = self.class::ID_OR_SCHEMA_FORMAT_REGEX
1011

1112
### Root ###
1213
# /
@@ -332,7 +333,7 @@
332333
scope '/resource', as: 'resource' do
333334
get '/', to: 'resource#index'
334335
scope '/:resource_id' do
335-
get '/', to: 'resource#show', resource_id: id_format_regex
336+
get '/', to: 'resource#show', resource_id: id_or_schema_format_regex
336337
end
337338
end
338339

0 commit comments

Comments
 (0)