Please check the APress web site for code downloads, errata, etc.
APress web page for my book that also contains the code download link.
February 2012: I put the example source code and data in a github repo.
I have used Ruby 1.9.1 for much of my development since January 2009. Ruby 1.9.x does not require "require 'rubygems'" before requiring locally installed gem libraries. If you are using Ruby 1.8.x, and if any of my example programs fail to load gems that you have installed, then I probably did not put a "require 'rubygems'" at the top of the example source file - so, please add this statement and try re-running the example.
Your best bet getting this old example web app running is to stick with the old version of Rails (2.3.2) that I used to write it and use Ruby 1.8.7. The example code is not compatible with Ruby 1.9.x. If you want to use JRuby that is also possible but you might want to switch the database to MySQL or PostgreSQL to avoid the hassles of getting SQLite3 working with JRuby.
You will have to either find an old version of the Twitter gem or change the Ruby code in the MashupController class. The new Twitter gem uses OAuth, which is good, but breaks the APIs that I used almost 4 years ago when I wrote this example web application.
I believe that the Google Maps APIs have also been changed.
The same reader who reported problems on 2/24/2012 with the AMI is now having problems with the Ruby setup on the AMI, specifically, it looks like he did a "gem install rails" and is now running into a Rails 2.x vs. Rails 3.x compatibility issue.
I recommend that readers stop using the AMI and instead just get the latest version of the example source code and data files from the github repo for the book examples. I had originally setup the Amazon AMI to save readers some time, but it is now apparently out of date. When you use the Rails examples, don't try to use the latest versions of Rails. I used version 2.3.2 of Rails while writing this book.
gem sources -a http://gems.github.com gem install scrubber-scrubyt
git clone git://github.com/davidx/jruby-lucene.git cd jruby-lucene gem build gem install jruby-lucene-*.gemThey should be:
git clone git://github.com/davidx/jruby-lucene.git cd jruby-lucene rake build gem install jruby-lucene-*.gemAlso: here, "gem" should be the JRuby gem, so unless the JRuby bin directory is before the Ruby bin directory on your path, you might want to use:
jruby -S gem install jruby-lucene-*.gemAlso, when running the interactive example, it may be required to require rubygems before jruby/lucene:
irb(main):002:0> require 'rubygems' => true irb(main):003:0> require 'jruby/lucene' => true
# with !, it creates the database if it doesn't already exist db = CouchRest.database!("http://127.0.0.1:5984/test") response = db.save_doc({'key 1' => 'value 1', 'key 2' => ..... })For some versions of the gem, the method "save_doc" may be "save".