On 17 Jan 2009, at 16:45, srj wrote:
> > In Rails 2.2.2, if I retrieve a record using a Model.find method (any > of the finds), make changes to it, and then save it, is there a > possibility that another user (on a different thread, maybe a faster > machine) could read the same record after me, but update it before > me? If so, then the other user's changes would be lost (a data > concurrency problem). Yes > > > How does Rails prevent this? > > Is there a way to do something like > Model.save_only_if_updated_at_is_unchanged ? > Is there a find_and_lock, find_for_update, or other similar function? > Look up optimistic locking. Fred > This is different than dirty records, because it is comparing the > record I have in my session to the same record in the database to > ensure that *no one else* changed it. > > Thank you, > > Steve > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

