# Before\_create firing twice on a save - RC2

**URL:** <https://www.ruby-forum.com/t/before-create-firing-twice-on-a-save-rc2/81396>\
**Category:** Rails\
**Created:** [January 8, 2007, 7:47pm UTC](https://www.ruby-forum.com/t/before-create-firing-twice-on-a-save-rc2/81396 "2007-01-08T19:47:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [January 8, 2007, 7:47pm UTC](https://www.ruby-forum.com/t/before-create-firing-twice-on-a-save-rc2/81396/1 "2007-01-08T19:47:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [January 15, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/before-create-firing-twice-on-a-save-rc2/81396/2 "2007-01-15T20:13:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [January 16, 2007, 2:26am UTC](https://www.ruby-forum.com/t/before-create-firing-twice-on-a-save-rc2/81396/3 "2007-01-16T02:26:20Z")

</div>

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?
