I'm inclined to say that if we follow two these two rules in AR: 1. Any value from the database is converted to the ruby type that higher layers expect to see, *before* assigning it to the attribute. 2. Any value being written to the database is converted just before it's sent to the underlying database driver.
All the problems will go away. There's nothing special about binary data, there are many types that need correct conversion to/from the database.
However, I also like your idea, because it allows lazy conversions (which could be a win on large binary data). But the most important thing to me is correctness.
Regards, Jeff Davis