Rails: Working around Tiger (OS X 10.4) ruby mysql problem
I was partly heart broken and partly frustrated and hoped that some mac and ruby 'guru' at the upcoming Seattle.rb Hack Night can help.
But then I had a thought and it worked.
I installed the latest stable version of ruby (1.8.3):
Download from: ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.3.tar.gz
shell> tar -zxvf ruby-1.8.3.tar.gz
shell> cd ruby-1.8.3
shell> make -j5
shell> sudo make install
This installs the new version of ruby in the /usr/local/bin directory on your powerbook
Now I added the new ruby path to my $PATH using
this would mean that any time a issue a command it would look in /usr/local/bin before /usr/bin where the old (tiger default version is installed). I have also modified my .profile to have a similar PATH in future.
then I downloaded and installed rubygem again:
Download from: http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
shell> tar -zxvf rubygems-0.8.11.tgz
shell> cd rubygems-0.8.11
shell> sudo ruby setup.rb
Next I installed rails gem
shell> sudo gem install rails --include-dependencies
Next I installed mysql gem
shell> sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql/
it worked for the first time now giving me a successfully installed message.
Finally I was able to do my scaffolding task as suggested by the book:
from your rails app directory do the following for the existing product table
shell> ruby script/generate scaffold Product Admin
It seems that the on Mac OS X you require a username in your database.yml file (you can't leave it blank otherwise it would default to root) so I had to modify my configuration on last time before seeing the magical command work.