Introduce class_names helper
As a follow-up to https://github.com/rails/rails/pull/37872, this change introduces a class_names view helper to make it easier to conditionally apply class names in views. Before: <div class="<%= item.for_sale? ? 'active' : '' %>"> After: <div class="<%= class_names(active: item.for_sale?) %>"> We've been using this helper in the GitHub monolith since 2016. Co-authored-by: NAaron Patterson <tenderlove@github.com>
Showing
想要评论请 注册 或 登录