Why <% concat(csrf_meta_tag) #aa%> is invalid while <% javascript_include_tag :defaults #abc%> is va

as the subject said.

On 17 April 2011 19:43, hanzhao [email protected] wrote:

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

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 %>

On Apr 17, 7:43pm, hanzhao [email protected] wrote:

as the subject said.

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 <%#

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs