Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

reloading a record does not update value of new_record?

#809

The history behind the bug here is a little strange.

I have a project that access a DB where all writes have to use stored procedures (don't blame me, I didn't make this decision).

The insert stored procedure takes the parameters and returns the primary key given to the new record. I then set the object's primary key manually and call reload.

This works fine (all the fields look as they should), but calling new_record? on the object still returns true.

Example

c = Company.new c.name = 'foo' c.write_new_record c.new_record? => true

where

def write_new_record return false unless valid? result = connection.select_all self.insert_query self.id = result[0]['idx'] reload end

insert_query is the method which inserts the parameter values into the sql query.

Like I said, everything works fine except the new_record? flag.

I know this is a bizarre edge case, but I thought I'd file it anyway.

Reported by Andrew Selder · August 12th, 2008 @ 09:27 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. josh
    josh
    • State changed from new to wontfix

    November 22nd, 2008 @ 07:35 PM