I have a unit test which fails using Rails 1.2RC2, because a method marked by the before_create filter is firing twice when my ActiveRecord is saved. Is a before_create filter supposed to cause multiple invocations? We have assumed it is called once, and only once, when the object is created, in our code (but we unit tested it to make certain). This is one of three issues I have with my unit tests on RC2. I''ll post separately for the other two, when I''ve done more research on those. Regards, Lori --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So, doesn''t anyone have anything to say about the semantics of before_create? Is it, or is not, valid for the before_create filter to fire twice? On 1/8/07, Lori Olson <javadragon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have a unit test which fails using Rails 1.2RC2, because a method marked > by the before_create filter is firing twice when my ActiveRecord is saved. > Is a before_create filter supposed to cause multiple invocations? We have > assumed it is called once, and only once, when the object is created, in our > code (but we unit tested it to make certain). > > This is one of three issues I have with my unit tests on RC2. I''ll post > separately for the other two, when I''ve done more research on those. > > Regards, Lori >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Lori, can you give more details? For example, what is the test that is failing, and its context? Can you also include what you think are the relevant lines from the controller? Can you include the part of the test.log that is relevant? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- before_create is after_validatation :on => :create , when it should be before_validation :on => :create
- self in before_create
- DB trigger vs before_create
- Using before_create and conflicting setter method...
- Cruisecontroi footprint for a virtual machine installation