I’ve got a Rails app and a Sinatra app inside it:
routes.rb:
mount MySinatraApp => "/streaming"
sinatra app:
class MySinatraApp< Sinatra::Base
...
before do
puts 'hello from sinatra!'
end
...
end
I expectedly want the filter to run only on the requests starting with /streaming..., but, what surprises me, the filter runs on every request to the whole Rails app. What can I do with such a behaviour?
I can add a regexp filter after before, but I don’t think it’s a good style.
Well, I replaced
with
and filters started to word as expected.
Allthough, I do not understand clearly why it is happening: according to this article, mount should just call match with
:anchor => false, so the routes should be the same. But the behaviour differs.