search for: staleobject

Displaying 1 result from an estimated 1 matches for "staleobject".

Did you mean: saveobject
2006 Aug 16
1
Stale object errors
...e object problems with methods that at first glance appear fairly atomic - eg Message.update(params[:id], {:body => params[:value]}) Of course, Rails has to instantiate the object & validate it before it updates the database, so it''s not actually atomic, hence the occasional staleobject error. So I''ve been wondering about creating a block method looking something like: def update_volatile_object num_attempts = 5 while num_attempts>0 begin yield # the block should do something along the lines of Message.update(blah) break # If we got h...