steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-09 20:56 UTC
after_update and increment!
I''ve got a strange behaviour that didn''t seem to be happening before I upgraded to 1.2. I''ve got two models - questions and results. When a user answers a question, his answer is recorded in results. In my results model, I have an after_create that increments! a count in the question model. This increment is now triggering an after_update method I have in a question_sweeper. (which causes an error) This sweeper is used to sweep my question cache files. I started noticing this problem when I went into production mode. Development mode pre-1.2 was working fine. Production mode pre-1.2 was not. I upgraded to 1.2 today because I thought an older edge rails might have a bug in it. After I upgraded to 1.2, now the problem is occurring in development mode as well. Anyone have any suggestions? Thanks, Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-10 00:35 UTC
Re: after_update and increment!
I fixed it with a simple fix. I changed my sweeper to a after_validation_on_update instead of after_update. The count/ increment field does not get validation of course so it doesn''t get triggered. On Feb 9, 2:56 pm, steve.o...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I''ve got a strange behaviour that didn''t seem to be happening before I > upgraded to 1.2. > > I''ve got two models - questions and results. > > When a user answers a question, his answer is recorded in results. In > my results model, I have an after_create that increments! a count in > the question model. > > This increment is now triggering an after_update method I have in a > question_sweeper. (which causes an error) This sweeper is used to > sweep my question cache files. > > I started noticing this problem when I went into production mode. > Development mode pre-1.2 was working fine. Production mode pre-1.2 was > not. I upgraded to 1.2 today because I thought an older edge rails > might have a bug in it. After I upgraded to 1.2, now the problem is > occurring in development mode as well. > > Anyone have any suggestions? > > Thanks, > > Steve--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---