# \[ANN\] Sidebars made Simpler: Body Builder

**URL:** <https://www.ruby-forum.com/t/ann-sidebars-made-simpler-body-builder/160682>\
**Category:** Rails\
**Created:** [February 18, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/ann-sidebars-made-simpler-body-builder/160682 "2009-02-18T19:44:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wybo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/cc9497/32.png) [@wybo](https://www.ruby-forum.com/u/wybo)\
**Post date:** [February 18, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/ann-sidebars-made-simpler-body-builder/160682/1 "2009-02-18T19:44:32Z")

</div>

This plugin fixes the problem of how to organize the parts of your app  
that are re-used like blocks across pages, like those in side-bars and  
top-bars. It allows you to create render-points where content can be  
inserted in views.

In short it allows one to set body\_parts (variables that can be yielded  
in views) from controllers. Also since Rails components are  
notoriously slow, this is a nice alternative.

After installing the plugin you can declare body parts in your  
controllers (most often only in controllers/application.rb) with:

body\_parts :top, :sidebar

Then you can fill them up in the same, or in inheriting controllers  
by passing method syms to body-name\_body, just like Rails filters:

top\_body :navigation\_bar

The return value of these methods will be added to the body.

In the view you can display the body with

\<= yield :sidebar\_body %\>

resp.

\<= yield :top\_body %\>.

As you can see Body Builder supports multiple, user-defined bodies.  
This contrary to the Simple Sidebar plugin.

See the full Body Builder docs for code examples and installation  
instructions: [http://www.logilogi.org/pub/doc/plugins/body\_builder/](http://www.logilogi.org/pub/doc/plugins/body_builder/)

Body Builder is under the Affero GPL, and developed by the LogiLogi  
Foundation ([http://foundation.logilogi.org](http://foundation.logilogi.org))

greetings,

Wybo W.

* * *

:🧑‍🎓

- Informatiekunde (computer linguistics, IR, webtech), History and  
Philosophy
- Member of the Center for Metahistory Groningen  
([Faculty of Arts | About us | University of Groningen](http://www.rug.nl/let/cmg))

::Free Software and Open Source Developer:

- Active in the LogiLogi Foundation ([http://foundation.logilogi.org](http://foundation.logilogi.org))
- [http://www.LogiLogi.org](http://www.LogiLogi.org), Cumulative, shared commenting, publication  
and  
idea sharing: Where insight comes together…
- ComLinToo, a computational linguistics toolset written in Perl

---

<div class="post-metadata">

**Author:** ![wybo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/cc9497/32.png) [@wybo](https://www.ruby-forum.com/u/wybo)\
**Post date:** [February 18, 2009, 8:02pm UTC](https://www.ruby-forum.com/t/ann-sidebars-made-simpler-body-builder/160682/2 "2009-02-18T20:02:15Z")

</div>

Thank you for sharing this. We have a lot of pieces of our application  
which are re-used many times, this could help!

JM
