Saturday, January 31, 2009

More notes on switching my development system to Ruby 1.9.1

I have been converting (on my development system, not in production yet) my Rails applications to work with Ruby 1.9.1. I converted my non-Rails stuff (that I care about) to work with 1.9.x a while ago.

I still use ferret for single process (or single thread) web applications. I have wanted to switch to Sphinx and UltraSphinx for a while and since ferret is not compatible with Ruby 1.9.x because of changes for unicode (RString struct, specifically) I did that conversion late last night. I was pleasantly surprised how simple it was to switch to Sphinx and UltraSphinx: lots of little edits, but quick and easy.

A little more frustrating: the auto_complete Rails plugin does not seem to be Ruby 1.9.x compatible in one of my Rails web apps. I am going through the plugin code, adding debug output, and looking for the problem. The problem may just be specific to my application.

Because of the performance improvements of 1.9.x and because of the long term maintenance overhead of having (eventually) both ruby 1.8.x and ruby 1.9.x applications in deployment, I am willing to spend a lot of effort on the conversion. Another issue is that I expect to have a Ruby book published early summer of 2009 and I would like all the examples to be Ruby 1.9 compatible (and some JRuby specific code).

6 comments:

Robb said...

Thanks for these posts. I'm doing the same thing, because in my dev environment, my app uses a rake task to build a knowledge database from 30,000 web pages. ruby 1.9.1 makes this much faster.

And I was just about to install Ferret and found it's compatible. How do you like Sphinx/Ultrasphinx compared to Ferret?

Mark Watson, author and consultant said...

Hello Robb,

I like UlraSphinx+Sphinx: really easy to setup: first install Sphinx, make sure that Spinx/bin is on your PATH. You don't have to configure Sphinx - UltraSphinx will do that for you. Then install UltraSphinx as a Rails plugin, and use the UltraSphinx rake tasks to configure and run.

paddor said...

Have you been able to fix the issue about auto_complete plugin on Ruby 1.9? I encountered the same problem and really have no idea what the problem is. It worked perfectly with ruby 1.8.7, CSRF isn't the problem either, the SQL query is executed in the DB like it should. It just doesn't display on the homepage (didn't change and CSS or made any browser update). The rest of my application works. Thanks for your ideas. :-)

Mark Watson, author and consultant said...

Hello Paddor,

I had that problem a long time ago - I am not absolutely sure, but I probably updated the plugin from:

http://svn.rubyonrails.org/rails/plugins/auto_complete

Try:

script/plugin install http://svn.rubyonrails.org/rails/plugins/auto_complete --force

paddor said...

Thanks for your comment on this. But I just created a new Rails app with Ruby 1.9 dedicated to test this problem and it still doesn't work. I think I already have the latest version of auto_complete (from September 11, 2007, see http://github.com/rails/auto_complete/tree/master).

And your link is dead. Can't install the plugin from that address. :-(

Thanks anyway.

Mark Watson, author and consultant said...

Hello Paddor,

Sorry that did not work out: I copied this suggestion from my notes for a project from last January.

Not easy getting there, but the world will be a better place when we have all been able to move on from Ruby 1.8.* :-)