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. Tags: .

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.

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

    I have similar problem in generators, but i put
    ERB.new(file.read.gsub(/\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

    Reply
  • 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.

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

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

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

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

    Thanks.

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

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

    Reply

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

You are commenting using your Google+ 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 http://webonrails.com . I will continue posting at http://webonrails.com, not on https://webonrails.wordpress.com.

Kindly update your book marks to http://webonrails.com

and http://webonrails.com/feed .

I am really very sorry for inconvenience.

Comming Soon….

Domain for Sale

TheRailsHosting.com


(Contact me)

Recent Posts

Calender

August 2006
M T W T F S S
« Jul   Sep »
 123456
78910111213
14151617181920
21222324252627
28293031  

Subscribe

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

del.icio.us

Feeds

Flickr Photos

A bellezza di a natura (C☺rsica)

JWL5932 Mountain Hare..

Black and Gold

More Photos

Visitor’s Location

Blog Stats

  • 17,978 hits

%d bloggers like this: