jnicklas/carrierwave-mongoid — pull request #72 by peteonrails (2012-11-22 01:06:48+00:00)
Title: Mongoid 3.0 - Fix the to_json serializable hash duplication issue

This small change to serliazable_hash will fix part of the issue described in https://github.com/jnicklas/carrierwave-mongoid/pull/59

Please note that it does not fix all of the failing specs submitted by NVDK, just the one that relates to the to_json serialization returning the wrong info when multiple uploaders are used.

The crux of the issue is that serializable_hash was being defined each time mount_uploader is called, with each successive call overwriting the method definition. This wouldn't be a big issue, except that the method uses :#{column} with interpolation. I have changed this to use column.to_sym, which ensures that at runtime the _mouter gets the right column name.

As I fix the rest of the specs, I am thinking that serializable_hash may need to come out of the class_eval block.

Does that sound right to you?