Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Problem with '%' as first character in a template

#1468

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.

Reported by Fjan · November 25th, 2008 @ 12:31 PM

State: invalid
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • 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.

    March 10th, 2009 @ 12:49 PM

  2. Fjan
    Fjan

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

    March 10th, 2009 @ 12:55 PM