I have a very simple Ruby question. Is there a way to refactor this:
<%= some_array.length if some_array.length > 1 %>
into something like
<%= some_array.length if self > 1 %>
where ‘self’ (for example) is references the initially calculated value – i.e. some_array.length?
I like to keep the main templates simple and pull logic into helpers. The erb can contain:
where the helper contains:
Of course, adjust the names to best represent your business logic.