I have a few cases where a particular value on a page should take 1 of
2 values and so at the top of the template I chose which:
count = @count1 || @count2
<%= count %>
Often the decision between the two is a little more complicated e.g.,
based on their values. The question is where should this sort of code
go? In a helper? It is the controller that generates the instance
variables @count1 and @count2 so it could very easily do the whole
calculation and create another instance variable (both @count1 and
@count2 are used elsewhere in the page so are still required). Or
should this sort of thing be an attribute on a model?
I am never sure where this sort of logic should go as it is kind of
view logic and kind of business logic.
Thanks in advance,