This project is archived and is in readonly mode.

#1468 ✓invalid
Fjan

Problem with '%' as first character in a template

Reported by Fjan | November 25th, 2008 @ 12:31 PM | in 2.x

If the first character in an ERB template file is a '%' the first sentence no longer gets recognized as inline Ruby in Rails 2.2.2 (in Rails 2.1.2 it was correctly interpreted).

My guess is that Rails prepends something to a template file so that Erb no longer recognizes the first character as the first character. Adding a newline before it, or changing the line to the <% %> form fixes it. So the bug only appears when Erb is configured to recognize % as the first character with: config.action_view.erb_trim_mode = "-%"

I have many templates starting with: % @title = "...", as is not uncommon, and this was a very hard bug to find. so it would be great if this could get fixed.

Comments and changes to this ticket

  • Pratik

    Pratik March 10th, 2009 @ 12:49 PM

    • Assigned user set to “Pratik”
    • State changed from “new” to “invalid”

    This sounds like an ERB issue, and maybe just the expected behaviour. You could try changing erb_trim_mode.

  • Fjan

    Fjan March 10th, 2009 @ 12:55 PM

    It worked fine under rails 2.1.2 so it's unlikely to be ERB

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages