I’ve posted some days ago about the lack of proper documentation for the
testing framework used by Rails.
Today, among other days, I noted one more method missing documentation.
I’ve read the past year about nested layouts in some blog I don’t
remember.
Today I had to write a new application and needed the nested layouts
again.
First, I looked at the documentation, as I use to do. Didn’t find. Then
I
looked at my other project code and found how, although I couldn’t find
this feature documented.
Into the documentation there are references for:
render (ActionView::TemplateHandlers::Compilable)
render (ActionView::TemplateHandler)
But none of them had any documentation available (although I’m not sure
these are the methods I should be looking for. Maybe it should be
“render
(ActionController::Base)”).
Well, the requirements are quite simple, so is the solution, but finding
it
on documentations is impossible, unless I’m missing something.
To keep it clear, here is the actual case:
I want to have a master layout (application.erb) and another layout
(another.erb) for the AnothersController, based on master layout.
application.erb:
... <%= yield :further_header %> ...another.erb:
<% content_for :further_header do %>
Further content here
<% end %>
<%= render ‘layouts/application’ %>
Quite simple, don’t you think? So what am I complaining about? This is a
very useful hidden feature. It is not documented. Even worse, the render
method is not documented. And even if I didn’t care about others
reaching
this feature, I would care if this feature will continue working in the
next Rails releases. Once a feature is documented, there is a great
chance
it will continue to be supported…
I would like to help documenting such missing documentation, but I need
some
instructions how can I do that: how to make patches, and need to know
how
do these methods actually work.
Thanks in advance,
Rodrigo.