rails/rails — pull request #3421 by senny (2011-10-24 14:09:49+00:00)
Title: The :converter Proc from #composed_of can return nil

We have very sensible value objects, which can't be created with invalid data. I supplied a patch to allow the `:converter` Proc to return nil. Before the patch, returning nil resulted in a confusing `NoMethodError` on `NilClass` when ActiveRecord tried to set the mapped properties to the corresponding value. The patch uses the `:allow_nil` options to decide, whether the `:conversion` Proc can return nil values.

The patch changed the code in a way that the conversion Proc was run also for nil values. This backward compatibility issue wasn't caught by a test so I wrote one in a separate commit.

This is a re-open of #3420 because I picked the wrong merge-traget.