[Rails] ERB % tag shortcut

Gavin Sinclair gsinclair at soyabean.com.au
Tue Nov 16 07:56:08 GMT 2004


Hi,

ERB allows you to shortcut the

  <% Ruby code goes here %>

tag with a single %

  % A line of Ruby code goes here.

It has to be the whole line.  To access this functionality, Rails
would need to be careful when setting up the ERB object:

  template = ERB.new(..., '%')

Does Rails support this shortcut?  I'm purposefully not looking up the
documentation, because if it does and I don't know by now, it's
perhaps not well enough documented.

Cheers,
Gavin




More information about the Rails mailing list