This project is archived and is in readonly mode.

#809 ✓wontfix
Andrew Selder

reloading a record does not update value of new_record?

Reported by Andrew Selder | August 12th, 2008 @ 09:27 PM | in 2.x

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.


c = = 'foo' c.write_new_record c.new_record? => true


def write_new_record return false unless valid? result = connection.select_all self.insert_query = 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.

Comments and changes to this ticket

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>

People watching this ticket