Forum: Ruby on Rails when i save, rails doesnt update the model instance with the

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3ccdcc71db4c8212fba584953572bf51?d=identicon&s=25 Noel R. Morais (Guest)
on 2006-02-24 21:30
(Received via mailing list)
Hi everybody,

Im using sqlserver (sqlserver adapter).

I think that is some bug.

any idea?
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-02-24 21:45
(Received via mailing list)
Are your saves working?

unless object.save
   raise :Yikes
end

Perhaps your model isn't validating?

--
-- Tom Mornini
3ccdcc71db4c8212fba584953572bf51?d=identicon&s=25 Noel R. Morais (Guest)
on 2006-03-16 00:10
(Received via mailing list)
yes, my saves are working fine....
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 François Beausoleil (fbeausoleil)
on 2006-03-16 03:05
(Received via mailing list)
2006/2/24, Noel R. Morais <noelrocha@gmail.com>:
> Im using sqlserver (sqlserver adapter).
>
> I think that is some bug.
>
> any idea?

Are you saying that you change the model's ID and that the save does
not update the ID of the record ?

I'm not sure that changing the ID is supported.

Check the log to see what gets saved.

Hope that helps !
3ccdcc71db4c8212fba584953572bf51?d=identicon&s=25 Noel R. Morais (Guest)
on 2006-03-17 15:40
(Received via mailing list)
What is happening is that when i do:

m = Model.new
m.description = 'Another test'
puts 'Work fine' if m.save
puts 'The attribute ID wasn't updated' if m.id.nil?
m = Model.find(:first, :order => 'id desc' )
puts m.description

The output is:
$: Work fine
$: The attribute ID wasn't updated
$: Another test

The record was inserted but the model object wasn't updated with the
id of the new record.
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-03-17 17:37
(Received via mailing list)
Is your ID column set to auto-increment?

--
-- Tom Mornini
3ccdcc71db4c8212fba584953572bf51?d=identicon&s=25 Noel R. Morais (Guest)
on 2006-03-17 19:32
(Received via mailing list)
yes .....
This topic is locked and can not be replied to.