Maybe this is old news, but it took me all afternoon: In my test environment, an ''after_create'' callback was getting called twice unexpectedly. In my model, I had a simple ''after_create :foo'' declaration. From what I understand, the problem seems to be that the ''after_create :foo, :bar'' syntax appends those symbols to an array without doing a ''uniq''. It seems that if you happen to load the class twice, you''ll get double entries in the callback list. This can happen easily because the Ruby ''require'' method doesn''t seem to convert paths to absolute paths, e.g the following will cause the file ''/lib/foo.rb'' to be loaded twice: # In \app\models\bar.rb require File.join(RAILS_ROOT, ''lib'', ''foo'') require ''../../lib/foo'' class Bar < ActiveRecord::Base end So, I added this to my environment.rb: module Callbacks def callbacks_for_with_uniq(method) callbacks_for_without_uniq(method).uniq end alias_method_chain :callbacks_for, :uniq end - OR - You could use the alternate form of defining a callback, but this is less convenient. def after_create # ... end -- 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 -~----------~----~----~----~------~----~------~--~---