This might be an issue with dirty attribute tracking - if Rails doesn't think an attribute is changed *based on the data it has in memory for that object, *it won't run the update. Keep in mind the update_attribute call is really just an abstraction around setting the object via a setter and calling .save. A quick way to confirm this is likely the culprit is to force it by doing this before the update_attribute call:
@interview.results_will_change! If this is indeed the culprit, tracking down the root cause is a bit more involve and depends on other code you've got running during that controller action. But I suspect it has something to do with dirty attribute tracking, possibly in conjunction with the AR identity map. Ben On Sat, Apr 21, 2012 at 8:34 AM, Scott Olmsted <[email protected]> wrote: > I'm running Rails 3.2.3 / Ruby 1.9.3-p125 at Heroku. The site owner > reported that a form very occasionally didn't update the database, which I > confirmed. So I tried it locally, where I use MySQL, and finally saw it > after many tries. The expected UPDATE between BEGIN and COMMIT once in a > while is not there (http://pastebin.com/zkuXPnA2). > > Could this be a caching issue? Or what? > > Thanks, > > Scott > > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
