开发者

Why render_component is deprecated?

Why render_component is deprecated in Rail开发者_如何学编程s > 2. What is the rational behind that ?


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:

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜