Today I ran into odd syntax errors in Rails rhtml views while trying to
set up acts_as_ferret. I have tried Ruby 1.8.4 and Ruby 1.8.5, both from
the Ruby-mswin32 binary packages and the Ruby O.-click Installer. I am
using ferret gem 1.10.9 and the stable version of acts_as_ferret. I
tried both the pre-built ferret-win32 gem and building the ferret-ruby
gem myself with VC6. The errors change, but always go something like
./script/…/config/…/app/views/search/query.rhtml:5: Invalid char
`\002’ in expression
./script/…/config/…/app/views/search/query.rhtml:6: parse error,
unexpected tIDENTIFIER, expecting kEND
_erbout.concat " "xP; _erbout.concat(( “%d%%” % (result.RANK /
1000.0 * 100) ).to_s); _erbout.concat “\n”
./script/…/config/…/app/views/search/query.rhtml:7: parse error,
unexpected $, expecting kEND
Views will render fine before I request a page that calls Ferret.
After any use of Ferret, the above errors occur in all views, until I
kill and re-start WEBrick. I have seen a lot of threads around about
this problem, but none of them have any information about what actually
causes it. See for example:
I would really like to know what the root cause of this problem actually
is, so I can figure out if there’s something that I can do to fix it.
Many threads I’ve seen blame it on RMagick, but I don’t even have
RMagick installed. Most others just say “replace all tabs with spaces.”
Well, OK, but I don’t really see that as an acceptable solution.
Does anyone have any information about why removing tabs fixes this
problem? Why does loading C extensions trigger it? What’s going on with
the Ruby interpreter? I want to know more.