Alternatives to components?


#1

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)?


#2

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


#3

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
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)?


#4

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.


#5

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

Joe