From: sto.mar@... Date: 2012-10-31T02:25:53+09:00 Subject: Re: Erb syntax - unknown syntax Am 30.10.2012 13:10, schrieb Georgy Daniel: > I don't think it is associated with the if condition, here there is > another instance of the '!' > > <%! > require 'cgi' > require 'json' > ..................... > ..................... > %> > > Also here is the if condition block > > <%! if filmstrip_image_path.blank? %> >
> My Image > >
> <%! end %> And this code works? Are you really using the standard erb? For me (ruby 1.9.3p194), the following template gives a syntax error <%! if true %> true <%! end %> Because this is interpreted as ! if true ... ! end where the first '!' is possible but completely useless here, and the second '!' is syntactically wrong. The fact that <%! has no special meaning but is treated like <% and the boolean `!' can be seen here: require 'erb' template = < <%= text %> EOF puts ERB.new(template).result outputs `true!!!', because the ruby code is taken to be !false && (text = 'true!!!') and the assignment of `true!!!' to the variable takes place. The same with <%! true && ... %> gives no output, as expected. --