This project is archived and is in readonly mode.

#811 ✓resolved
Conrad Taylor

Redirect Error After Model Creation

Reported by Conrad Taylor | August 13th, 2008 @ 01:24 AM | in 2.x

Hi, here are the steps that I performed:

a) rails restapp

b) cd restapp

c) ./script/generate scaffold Person name:string description:text

d) rake db:migrate

e) add the the following to the top of the routes.rb:

  map.root :controller => 'people'

f) ./script/server

g) go to the following address within your browser


h) click the 'New person' link and complete form

i) click the create button and you should see the following message:

ActiveRecord::RecordNotFound in PeopleController#show

Couldn't find Person with ID=0 RAILS_ROOT: /Users/conradwt/ruby.dir/projects/restapp

Application Trace | Framework Trace | Full Trace vendor/rails/activerecord/lib/active_record/base.rb:1375:in find_one' vendor/rails/activerecord/lib/active_record/base.rb:1358:infind_from_ids' vendor/rails/activerecord/lib/active_record/base.rb:537:in find' app/controllers/people_controller.rb:29:inshow' Request



Show session dump



{"cookie"=>[], "Cache-Control"=>"no-cache"}

Next, it the save succeeds but the redirect fails because it's trying to redirect to /people/0. After further investigation, in the console:


darnoc-desktop:restapp conradwt$ script/console Loading development environment (Rails 2.1.0)

a) person =

 The DL driver for sqlite3-ruby is deprecated and will be removed
 in a future release. Please update your installation to use the
 Native driver.
 #<Person id: nil, name: nil, description: nil, created_at: nil, updated_at: nil>

b) = "Conrad"


c) person.description = "This is yet another test"

 "This is yet another test"



e) person

 #<Person id: 0, name: "Conrad", description: "This is yet another test", created_at: "2008-08-12 23:00:27", updated_at: "2008-08-12 23:00:27">


Next, from the above, the id field isn't being properly updated after the save and I'm seeing this with the following setup:

OS: Mac OS 10.5.4

Platform: PPC G5

Ruby Version: ruby 1.8.7 (2008-08-08 patchlevel 71) [powerpc-darwin9]

Rails Version: Rails 2.1.0

Furthermore, this problem doesn't exist for my laptop with the following setup:

OS: Mac OS 10.5.4

Platform: Intel Core 2 Duo

Ruby Version: ruby 1.8.7 (2008-08-08 patchlevel 71) [i686-darwin9]

Rails Version: Rails 2.1.0

Lastly, it appears to be an installation/configuration issue on the PowerMac G5 in regards to SQLite3 using Rails 2.1.0 becausse this issue doesn't appear when using MySQL on this platform with this environment configuration.

Comments and changes to this ticket

  • Wesley Moxam

    Wesley Moxam September 18th, 2008 @ 03:15 PM

    • Tag changed from activerecord, bug to activerecord, bug

    You only mapped the root url to a controller. You need to map the person resource as well.

    map.resources :people

    This should fix your problems.

  • Conrad Taylor

    Conrad Taylor September 28th, 2008 @ 12:17 AM

    Hi, here's the complete routes.rb file that I'm using:

    ActionController::Routing::Routes.draw do |map|

    map.root :controller => 'people'

    map.resources :people

    # Install the default routes as the lowest priority. map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format'


  • Conrad Taylor

    Conrad Taylor September 28th, 2008 @ 12:36 AM

    I have just successfully tested the application using the following configuration:

    OS: Mac OS 10.5.5

    Platform: PPC G5

    Ruby Version: ruby 1.8.7 (2008-08-11 patchlevel 72) [powerpc-darwin9]

    Rails Version: Rails 2.1.1

    SQLite3 Interface: rb-sqlite3 @1.2.1_0 (active)

    SQLite3 Version: sqlite3 @3.6.1_0 (active)

    Thus, this issue is resolved using Rails 2.1.1.

  • Tarmo Tänav

    Tarmo Tänav September 28th, 2008 @ 01:56 AM

    • State changed from “new” to “resolved”

    As I understand it the issue is resolved, so I'm closing the ticket. Let me know in case I misunderstood.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>