why <% concat(csrf_meta_tag) #aa%> is invalid while <% javascript_include_tag :defaults #abc%> is valid?

as the subject said.

What's invalid about it? I assume you get some sort of error
message... can you post that to enlighten us, please?

Personally, though, I find I get problems with Ruby parsing if I
comment in ERB tags after code, instead I tend to do this if I
desperately want to comment in a view:
<% code here %><%# comment here %>

I assume you mean <%= in the second case. The way that erb generates
ruby code from a template means that comments aren't supported - the
comment inside the <% tag ends up commenting other bits of the code
generated by erb.
The only form of comments that are safe is <%#