[Rails plugin] Template inheritance provided by Rango in Rails!
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples @ 2a53ef6



This Rails plugin provides template inheritance from Rango for Rails, so you can just install it and enjoy advantages of template inheritance without any framework switching.

Please note that this plugin works just with Ruby 1.9.1 and higher!

See an example application

Template Inheritance

Template inheritance is incredibly simple, powerful and flexible way how to handle layout/template. You usually needs more levels of layouting and you can do it very easily with template inheritance. You can have i. e. app/views/admin/posts/show.html.haml with post-specific stuff, then app/views/admin/base.html.haml with administration-specific layout and then app/views/base.html.haml with the most generic layout.

See also explanation at DjangoProject.com


Rango is a light-weight web framework suitable for both smaller web services and bigger sites. It’s builded on top of Rack and it has very flexible and modular architecture. So modular that we can even use it in Rails as a drop-in replacement for Rails rendering layer.

- Rango Wiki
- Rango Introduction from Ruby Manor 2009

Template Adapters

Thanks to Tilt you can use Erubis or Haml, just by using the proper extension. Tilt itself supports much more, however Rango currently support just these two engines. Some engines won’t be supported just because they don’t support Ruby code in templates (Mustache and Liquid) etc.


As a Plugin

./script/plugin install git://github.com/botanicus/rails-template-inheritance.git

As a Gem

Add these lines into your config/environment.rb:

config.gem "tilt"
config.gem "rango", lib: nil
config.gem "rails-template-inheritance", lib: nil

Now run following tasks:

rake gems:install
rake gems:unpack

Via bundler

This is definitely the best solution since plugins can’t handle dependencies and Rails 2 bundling tasks are just general pain in the ass.

Just put gem "rails-template-inheritance" to your Gemfile and run gem bundle (you have to have bundler installed). Then you have to setup your config/environment.rb:

require_relative "../vendor/gems/environment"