[Boulder Ruby Group] ar save! problem

David Clements david at collectiveintellect.com
Thu Jul 12 00:22:52 EDT 2007


On Jul 11, 2007, at 9:01 PM, Tim Pease wrote:

> On 7/11/07, ara.t.howard <ara.t.howard at gmail.com> wrote:
>>
>> anybody every seen this behaviour:
>>
>>   @model.save!          # no error
>>   @model.update         # no error
>>   Model.find @model.id  # raises
>>
>> seems impossible...
>>
>>
>
> Does this happen only with newly created Model objects, or does this
> happen with Model objects loaded from the database?
>
> Does AR guarantee that it keeps the AR object and the database tables
> in sync at all times? It seems like that would be hard to do for newly
> created objects.
>
> Just another thought. Is your @model.id valid when you call  
> Model.find?
>
> TwP


I am assuming that id is nil ,right?  What if you do a something like  
Model.find_by_some_other_uniqe_key?
What does model.valid?  return.
Does the SQL look right in the log?
Anything weird with your model?   primary_key is AR standard?


Dave



> _______________________________________________
> Bdrg-members mailing list
> Bdrg-members at rubyforge.org
> http://rubyforge.org/mailman/listinfo/bdrg-members



More information about the Bdrg-members mailing list