Watch our Blog Tutorial Screencast - Padrino Ruby Web Framework

Mounting Applications

Padrino applications are all automatically mountable into other Padrino projects. This means that a given Padrino project directory can easily mount multiple applications. This allows for better organization of complex applications, re-usable applications that can be applied (i.e admin, auth, blog) and even more flexibility.

You can think of mountable applications as a ‘full-featured’ merb slice or rails engine. Instead of a separate construct, any application can simply be packaged and mounted into another project.


Mounting Syntax

Padrino stores application mounting information by default within config/apps.rb. This file is intended to keep all information regarding what applications are mounted to which uri’s. An apps.rb file has the following structure:


This would mount three applications onto the Padrino project, one served from the ‘/blog’ uri namespace one with ‘/website’ uri namespace and the other served from the ‘/’ uri namespace.


Advanced Mounting Support

In addition to the basic mounting capabilities afforded by Padrino for each application within a project, the Padrino::Router also allows for more advanced mounting conditions.

The Padrino::Router is an enhanced version of Rack::UrlMap which extends the ability to mount applications to a specified path, or specify host and subdomains to match to an application. For example, you could put the following in your config/apps.rb file:

# Adds support for matching an app to a host string or pattern

This will configure each application to match to the given host pattern simplifying routing considerably.

blog comments powered by Disqus
Write at least 4 chars
Matches are highlighted


Guides Index


  • Last edited by DAddYE
  • Edited about 4 years ago