Elmar Schraml wrote:
I’d be really grateful for any tips on how to get my detailed error
pages back for debugging.
Thanks in advance,
Elmar
My configuration: Suse Linux , ruby 1.8.5, rails 1.1.6, server on
localhost:8080 started from within radrails 0.7.1
I was having the same problem and with a little debugging I determined
it was due to my config.action_view.erb_trim_mode setting in
config/environment.rb.
After a little research, I discovered the following:
If the ERB::Compiler::TrimScanner#explicit_trim_line is not invoked,
Rails (1.1.6|EDGE) rescue template craps out and doesn’t show the
stack trace. Instead, the public/500.html page is displayed. I believe
this is because the omittance of the newline will place serveral lines
of Ruby code on a single line and cause compiler/parse errors.
If using ‘<’ or ‘<>’, you will have to strategically place
newlines in your templates. Otherwise, you must invoke the
explicit_trim_line method, which is enabled by including a hyphen in
config.action_view.erb_trim_mode.
All possible values for erb_trim_mode:
- 1
- 2
- 0
- nil
- ‘%’
- ‘%-’
- ‘%>’
- ‘%<>’
- ‘-’ (Rails default)
- ‘>’
- ‘<>’
The source for ERB can be found in ruby-1.8.4/lib/erb.rb.
I’ve included an interesting method:
def prepare_trim_mode(mode)
case mode
when 1
return [false, ‘>’]
when 2
return [false, ‘<>’]
when 0
return [false, nil]
when String
perc = mode.include?(’%’)
if mode.include?(’-’)
return [perc, ‘-’]
elsif mode.include?(’<>’)
return [perc, ‘<>’]
elsif mode.include?(’>’)
return [perc, ‘>’]
else
[perc, nil]
end
else
return [false, nil]
end
end
Other interesting methods include:
- explicit_trim_line (invoked by specifying a hyphen)
- trim_line1 (invoked by specifying ‘%>’ or ‘>’ or 1)
- trim_line2 (invoked by specifying ‘%<>’ or ‘<>’ or 2)
- TrimScanner#initialize
-pachl