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?

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedOct 10, '11 at 6:07a
activeOct 10, '11 at 6:07a

1 user in discussion

Hbear: 1 post



site design / logo © 2022 Grokbase