# Alternatives to yield?!

**URL:** <https://www.ruby-forum.com/t/alternatives-to-yield/146695>\
**Category:** Rails\
**Created:** [August 24, 2008, 9:08am UTC](https://www.ruby-forum.com/t/alternatives-to-yield/146695 "2008-08-24T09:08:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [August 24, 2008, 9:08am UTC](https://www.ruby-forum.com/t/alternatives-to-yield/146695/1 "2008-08-24T09:08:10Z")

</div>

Hello,

I’m currently programming on a website and after quite some work I  
figured out that I need a sidebar too but there’s a lot already coded so  
I can’t really change yield because I would have to need to add the  
sidebar to many pages. Is there any alternative to add that bar (which  
needs of course some db data) without changing the whole website?

I thought about partials but then I don’t know how to get the data.

Does anyone have any idea?

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [August 24, 2008, 2:27pm UTC](https://www.ruby-forum.com/t/alternatives-to-yield/146695/2 "2008-08-24T14:27:18Z")

</div>

Have you looked into content\_for ? That lets you render to a different  
area on the template , so you should not have to rewrite to much.

[http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M002064&name=content\_for](http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M002064&name=content_for)

J

On Aug 24, 3:08 am, Heinz S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
