Reputation: 1383
I came from Django and Python background to RoR. My question in simple. Let's say, I have one application.html.erb
layout.
I want to make another layout called management.html.erg
which will inherit application.html.erb
and be able to use its yields and so on.
Something like {% extends "template.html" %}
in django.
Upvotes: 1
Views: 451
Reputation: 7719
You are looking for ActionView helper content_for
and yield
.
See guide about Layouts and Rendering in Rails for a brief overview and apidock for detailed documentation.
yield
is an analogue of Django's block
tag
content_for is an analogue of extends
tag.
Layout for which the content is selected is driven from a controller so there is no point to manually specify its name like in Django.
Upvotes: 3