They are both indicators that what follows should be treated as Ruby code. But - does not display the result for viewing, while = does.
For example, consider the following helper:
def hlp [1,2].each(&:succ)
each will return the enumerator to which it is called. Thus, the return value of this helper method will be [1,2] .
Below in your HAML view will not be displayed [1,2] :
- hlp
But this will display the following:
= hlp
Therefore, in the code sample you provided, you will use - , not = , because you do not want to display all @list.documents once each with them.
Humza source share