Tagged Questions
1
vote
0answers
134 views
Can I use optimistic locking of an object to guard its associations?
We're running into problems with a race condition in our rails app. Here's a bit of (simplified) code before I explain:
class Message < ActiveRecord::Base
belongs_to :question
end
class ...
1
vote
0answers
654 views
ActiveRecord::Base.connection.update(sql) sometimes returns incorrent number of affected rows
I have a production web site with the following environment:
Rails 2.3.5
MySQL Server 5.1.33
Enterprise Ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]
mysql gem 2.7
Old version of ...
0
votes
0answers
23 views
Rails optimistic locking update within a loop appears to work until I check from outside of the loop
I'm using optimistic locking on a Rails model. Inside of a loop, I update and save this model (or, rather, many instances of this model).
From inside the loop, I output the "before" and "after" ...
0
votes
0answers
104 views
Conflict of optimistic locking turned on and off in different classes
My whole project has lock_version turned off with 'ActiveRecord::Base.lock_optimistically = false'.
And I would like to turn it on only for one or two classes which I tried by adding ...