4 ms·
Rails has view helpers for that. Instead of <td class="<%= teacher.colour_coded_availability %>"> there would be <td class="<%= colour_coded_availability
by pmontra 1y ago
Rails has view helpers for that. Instead of
<td class="<%= teacher.colour_coded_availability %>">
there would be
<td class="<%= colour_coded_availability(teacher) %>">
but no metaprogramming, no decorators/ directory, no new concepts, only standard plain Rails. As a bonus it's even an instance of functional programming.
- arthurlewis 1y agoWell, until you need different `colour_coded_availability` methods for different contexts. Helpers get a lot done, but there are absolutely use cases for a separate presentation layer.