Alternatives to components?

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

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

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

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.

Perhaps “widgets” are the answer? link:


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs