Hi,
I'm seeing weird behavior on my live sites (can't seem to duplicate in development). Using Ruby 1.8.6 on solaris with postgresql.
I often times have code that looks like:
class Order belongs_to :user after_create :make_super_user def make_super_user if user.orders.count >= 50 user.make_super! end end end
class User has_many :orders def make_super! update_attribute :super, true end end
That sort of thing, where there's some check in an after_create callback that does a count and then modifies another object. However, these callbacks don't seem to be running correctly. Sometimes Users aren't made super after 50 orders. Or, in this example:
class QuestionAnswer belongs_to :question after_create :rotate_question def rotate_question Question.rotate! if question.question_answers.count >= 100 end end
Sometimes Question.rotate! is called if question.question_answers.count is less than 100. It's very weird. Anyone see anything like this?