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?
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---