Rails 3.1 and mysql

I have been having some trouble upgrading a rails app to 3.1. Latest
seems to be a 3.1 ↔ mysql issue. Here is what I have trimmed it
down to.

create a 3.1 app

rails new playing
cd playing

Change Gemfile to use mysql instead of sqlite (following lines in

the Gemfile)
#gem ‘sqlite3’
gem ‘mysql’
gem ‘ruby-mysql’

bundle install

Edit config/database.yml to configure for mysql.

rails generate scaffold race name:string distance:decimal
rake db:create
rake db:migrate
rails s

Now navigate to http://localhost:3000/races, select “New race” and

fill in the fields and then select “Create race”
The race is created in the database table, but the browser navigates
to an error page that reports.
“Couldn’t find Race with id=0” and indeed the url in the browser is

This works just fine with sqlite, but fails with mysql.

It looks like the save action is not updating the id value for the
saved record so the redirect sees an id of 0 and builds the URL. Just
wondering if anyone else has seen this and has a solution?