-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
sinatra/mustermann
#78Description
Hi,
I have the following app (which worked in sinatra < 2.0):
class App < Sinatra::Base
register Sinatra::Namespace
namespace '/foo/:year/?:period?' do
get '/status' do
status 200
end
namespace '/nested' do
get '/1' do
this_method_does_not_exist('hello')
status 200
end
helpers do
def this_method_does_not_exist(msg)
puts "hello #{msg}"
end
end
end
end
endWhen I call /foo/2018/2/nested/1 all works as expected. When I call /foo/2018/nested/1 it results in a
NoMethodError: undefined method `this_method_does_not_exist`
Duplicating the outer namespace "resolves" the issue:
class App < Sinatra::Base
register Sinatra::Namespace
namespace '/foo/:year/?:period?' do
get '/status' do
status 200
end
end
namespace '/foo/:year/?:period?/nested' do
get '/1' do
this_method_does_not_exist('hello')
status 200
end
helpers do
def this_method_does_not_exist(msg)
puts "hello #{msg}"
end
end
end
endFull test case can be found here: https://github.com/lvonk/sinatra-namespaces-issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels