Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7431359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:16:59+00:00 2026-05-29T09:16:59+00:00

I am building a modular Padrino application to mount mutiple applications. I am mounting

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:17:00+00:00Added an answer on May 29, 2026 at 9:17 am

    You can use standard sinatra extensions, put under lib:

    # lib/common_filters.rb
    module CommonFilters
      def self.registered(app)
        app.before do
          ...
        end
    
        app.after do
          ...
        end
      end
    end
    

    Then in yours apps:

    # app/app.rb
    class MyApp < Padrino::Application
      register CommonFilters
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking for advice on framework and approach for building a modular web application. Primary
I'm building modular application with 2 modules which share common vo: ShopRegionVO This vo
Building a client-side swing application what should be notified on a bus (application-wide message
Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't
I am building a modular project and am looking for the best way to
I am building a modular framework for a PHP MVC site. I am using
Building a rails B2B application that will have various users. I'm pretty clear on
We are building a large site which requires very modular CSS. The problem we
Building a Monodroid application we've been using Protobuf-net for serialization. It works in debug
I am building a web framework which is based on a hierarchical modular design.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.