看来每当get
scope
内有约束时,scope
的约束都会被忽略:
此处识别路线:
scope '(/:optional_slug)', constraints: ->(req) { raise 'first constraint!' } do
get '/:category/:slug(/:locale)' => 'public/posts#show',
constraints: ->(req) { true }
end
此处second constraints
被提出:
scope '(/:optional_slug)', constraints: ->(req) { raise 'first constraint!' } do
get '/:category/:slug(/:locale)' => 'public/posts#show',
constraints: ->(req) { raise 'second constraint!' }
end
仅当我从first constraint!
get
scope '(/:optional_slug)', constraints: ->(req) { raise 'first constraint!' } do
get '/:category/:slug(/:locale)' => 'public/posts#show'
end
我无法在解释此类行为的文档中找到它。我错过了什么或者它是一个错误吗?