# Alternatives to components?

**URL:** <https://www.ruby-forum.com/t/alternatives-to-components/59391>\
**Category:** Rails\
**Created:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/alternatives-to-components/59391 "2006-05-03T18:59:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/alternatives-to-components/59391/1 "2006-05-03T18:59:42Z")

</div>

I’m about to start work on sidebars for my app, but I’ve heard a number  
of people express doubts about them as the way to go (they are slow &  
apparently DHH regretted coming up with them components). What other  
solutions are people using for this type of need (i.e.needing to call an  
action/view combo from within a view)?

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/alternatives-to-components/59391/2 "2006-05-03T18:59:44Z")

</div>

I use the very ugly method of putting alot code into the application  
helper and calling it on each page.

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [May 3, 2006, 7:04pm UTC](https://www.ruby-forum.com/t/alternatives-to-components/59391/3 "2006-05-03T19:04:24Z")

</div>

Yeah, I can see that would work – but also that it’s none too elegant.  
In the api docs it says:

Donâ??t use components as a way of separating concerns inside a single  
application. Instead, reserve components to those rare cases where you  
truly have reusable view and controller elements that can be employed  
across many applications at once…  
Components  
[http://api.rubyonrails.org/classes/ActionController/Components.html](http://api.rubyonrails.org/classes/ActionController/Components.html)  
are a special-purpose approach that can often be replaced with better  
use of partials and filters.

Does anyone have any examples of using partials and filters to replace  
components (or any other comments)?

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [May 10, 2006, 12:08am UTC](https://www.ruby-forum.com/t/alternatives-to-components/59391/4 "2006-05-10T00:08:24Z")

</div>

Thanks. Will check them out. Am currently trying to sort something out  
with a before\_filter, and it’s sort of working, but not wild about how  
I’m doing it.

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [May 9, 2006, 8:43pm UTC](https://www.ruby-forum.com/t/alternatives-to-components/59391/5 "2006-05-09T20:43:46Z")

</div>

Perhaps “widgets” are the answer? link: [http://blogrium.com/?p=60](http://blogrium.com/?p=60)

Joe
