Hi, I''m refactoring some code related to autosaving associations. While doing this, I came across some code which doesn''t seem to do anything, or rather, no tests fail when this code is disabled. http://github.com/rails/rails/blob/b6e56efe07cb3c2e999216f995403aa9206226a2/activerecord/lib/active_record/associations.rb#L1027 I tried to write a failing test: def test_case_name treasure = Treasure.new(:name => ''gold'') treasure.save! treasure.looter = Pirate.new(:catchphrase => ''yarr'') treasure.save! assert_equal ''Pirate'', treasure.reload.looter_type end However, with the offending line of code removed the test still passes. So it seems that the looter_type (:foreign_type) is being set from somewhere else before getting to the before_save callback. If this code isn''t necessary anymore it would clean up nicely, since the 2 belongs_to before_save callbacks are almost identical. So any info would be appreciated. Cheers, Eloy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---