# Rendering directly from the controller into a named section of my layout

**URL:** <https://www.ruby-forum.com/t/rendering-directly-from-the-controller-into-a-named-section-of-my-layout/132819>\
**Category:** Rails\
**Created:** [March 25, 2008, 1:31am UTC](https://www.ruby-forum.com/t/rendering-directly-from-the-controller-into-a-named-section-of-my-layout/132819 "2008-03-25T01:31:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e68b1a/32.png) [@Pito](https://www.ruby-forum.com/u/Pito)\
**Post date:** [March 25, 2008, 1:31am UTC](https://www.ruby-forum.com/t/rendering-directly-from-the-controller-into-a-named-section-of-my-layout/132819/1 "2008-03-25T01:31:22Z")

</div>

My layouts/application.rhtml contains:

\<%= yield :main %\>

I would like to render directly from my controller into the :main  
section - that is, without using the usual view incantation:

% content\_for (:main) do %\>  
i am not crazy  
\<% end %\>

Instead, directly from my controller, I want to (essentially) do a

```
render :text => "I am not crazy"

```

And have that go into the :main section of my layout file.

* * *

Note: why do I want this? I believe this is a generally valid  
question, but if you are curious, I am using ActiveScaffold which  
automagically provides scaffold views dynamically so you don’t even  
write actual views. But my layouts are still in play and I need to get  
the dynamic scaffolds to go in the right place. … Maybe I am looking  
at this in the wrong way…
