I am building a modular Padrino application to mount mutiple applications.
I am mounting a base application to /
class BaseApp < Padrino::Application
...
end
I am then mounting other appilications to other endpoints, such as /clients
and these applications inherit from the base application:
class ClientsApp < BaseApp
...
end
This inheritence allows me to define all my settings, error handling and any included rack middleware in the app.rb
for the BaseApp
class.
So far so good. But I would also like to share before
and after
routing between apps. For example in my BaseApp
controller code I want to do this:
BaseApp.controller do
before do
...
end
after do
...
end
get :index do
...
end
end
Rather than repeating these filters in my ClientsApp
controller code, like so:
ClientsApp.controller do
before do
...
end
after do
...
end
get :index do
...
end
end
Is there anyway I can DRY up this code and specify the filters once in BaseApp
and have them somehow inherited? I understand these filters are methods calls rather than methods.
Thanks!