It's not about what is unreadable vs. what is readable, it's about
what is _more_ readable. The syntactic vinegar associated with the
multiline syntax is a great motivator to ask yourself, "Should this
really be in a helper?" If the answer is no, leave it how it is. If
the answer is yes, your code just got better.
I support a large rails project (>50 controllers, >100 models) and the
unpleasant multiline syntax has helped a lot. It's so unpleasant, in
fact, that we don't use it. If I don't want to create a helper
method for one line of code, I break it up. The example below would
start as
= link_to "Favorites <em
class='count_favorites'>#{count_favorites}</em>", "#"+resource(:users,
:favorites), :class => "dropmenu_trigger", :rel =>
"#dropmenu_favorites"
and become 3 lines if not a helper:
- favorites = "Favorites <em class='count_favorites'>#{count_favorites}</em>"
- fave_link_attrs = { :class => 'dropmenu_trigger', :rel =>
'#dropmenu_favorites' }
= link_to favorites, "##{resource(:users, :favorites)}", fave_link_attrs
Find your own style with this, but don't push for a syntax change
immediately, just because this isn't what you're used to.
Justin Dossey