Thursday, September 14, 2006

Tab Problem in rails .rhtml files

The situation was: running Ruby 1.8.4, Rails 1.1.2, on WinXP & WEBrick server.


My application was working fine, but as I installed Rmagick my application crashed.

I got strange errors like:


compile error /script/../config/../app/views/layouts/application.rhtml:18: parse error, unexpected $, expecting kEND


if I refresh again the error actually changes(further refreshes flip back & forth between errors):


compile error


/script/../config/../app/views/layouts/application.rhtml:18: Invalid char `01' in expression


./script/../config/../app/views/layouts/application.rhtml:19: parse error, unexpected tCONSTANT, expecting kEND


./script/../config/../app/views/layouts/application.rhtml:20: parse error, unexpected tCONSTANT, expecting kEND


./script/../config/../app/views/layouts/application.rhtml:21: Invalid char `06' in expression


./script/../config/../app/views/layouts/application.rhtml:21: parse error, unexpected $, expecting kEND


Then my colleagues told me the root of this problem, this was because of tabs in .rhtml files. Also they told me the simple solution:


Put template = template.gsub(/\t/, " ") in your


\vendor\rails\actionpack\lib\action_view\base.rb file at line 496 as very first line of def compile_template

Restart webserver and you are doneā€¦.

0 Comments:

Post a Comment

<< Home