views:

33

answers:

1

Hi All,

Why render_component is depreciated in rails > 2, What is the rational behind that ?

Thanks

cheers sameera

+2  A: 

render_component is very slow and it has special case usage which often can be replaced by simple partial.

As the README for the render_component says (http://github.com/rails/render_component):

Components should be used with care. They're significantly slower than simply splitting reusable parts into partials and conceptually more complicated. 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.

So to repeat: Components are a special-purpose approach that can often be replaced with better use of partials and filters.

Slobodan Kovacevic
Hithanks for the detailed explanation
sameera207