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.
I tried to write a failing test:
treasure = Treasure.new(:name => 'gold')
treasure.looter = Pirate.new(:catchphrase => 'yarr')
assert_equal 'Pirate', treasure.reload.looter_type
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.