Hi All,

Can anyone tell me how to manually mark a resource as existing, other than to 
load it from the database?  I can't find what I'm looking for in the API 
reference.  I have tried playing around with #persisted_state=() from within a 
"before save hook" without any joy (DM still tries to do an insert if I save 
the resource).

For better or for worse, the actual use case is to replace all the attributes 
in a newly created resource with the (same) attributes (including the primary 
key) of an existing resource that is deemed to be the same record (due to a 
unique constraint on one of the fields that is not the PK), prior to saving.  
It's not essential, but I am wondering where DM is making these decisions.  
Specifically these records are simple text tags with unique values.

I'm also trying to figure out how to prevent race conditions in DM, by 
performing a SELECT..FOR UPDATE to lock a row in the database.  Drop down to 
pure SQL?

Cheers,

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to