Tab Problem in rails .rhtml files

August 10, 2006 at 2:51 pm 6 comments

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….


Entry filed under: rails, RubyonRails.

converting all newline characters to br tag Ajax pagination links: Create pagination links with link_to_remote

6 Comments Add your own

  • 1. jose  |  September 2, 2006 at 3:02 pm

    I have the same problem. I can’t solve it in that way, but the bug is only on windows. In linux i have no problems.

  • 2. Benjamin Cardenas Salamandra  |  September 3, 2006 at 4:32 am

    I have similar problem in generators, but i put\t/, ” “), nil, ‘-‘).result(b)

    in line 277 of file \ruby\lib\ruby\gems\1.8\gems\rails-1.1.6\lib\rails_generator\commands.rb

  • 3. sur  |  October 5, 2006 at 2:02 pm

    This problem with rmagick should be solved by the latest version. Tabs should not be a problem for rails. The download, I believe, for the RMagick version with the fix is now up on RubyForge. Take care.

  • 4. franee  |  November 9, 2006 at 8:20 pm

    I had the same problem on windows.
    Thanks for the solution:)

  • 5. fenomenon  |  February 7, 2007 at 3:11 am

    got the same problem but could’nt resolve it with your suggestions.
    Any idea?


  • 6. Matte  |  March 28, 2007 at 3:48 pm

    Thanks Benjamin for your solution! It works well even with rails 1.2.2!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Important Notice…

I have moved this blog to . I will continue posting at, not on

Kindly update your book marks to

and .

I am really very sorry for inconvenience.

Comming Soon….

Domain for Sale

(Contact me)

Recent Posts


August 2006
« Jul   Sep »


  • Add to Google
  • Subscribe in NewsGator Online
  • Subscribe with Bloglines
  • WebOnRails on feedburner
  • technorati


Visitor’s Location

Blog Stats

  • 18,239 hits

%d bloggers like this: