timsly/carrierwave-serializable — pull request #7 by chancedowns (2014-05-14 17:39:00+00:00)
Title: Respect mount_on option and fix real issue with normal uploaders

Since the write_uploader and read_uploader methods get passed in a value that can be the mount_on option, this gem should respect that option and map to that if it exists.

The other change/fix is to revert and have a fix for https://github.com/timsly/carrierwave-serializable/pull/1 which was initially to fix normal uploaders. However, the merged fix will break the serialize_to uploaders if the serialize_to uploaders are put above the normal uploaders. For example:

mount_uploader :serialize_file_url, ImagesUploader, serialize_to: :serialize_column
mount_uploader :file_url, ImagesUploader

The reason for this is due to the class_eval inserting the patched ones first, then carrierwave inserting the normal read/write_uploader methods afterwards. I believe the proposed fix should fix https://github.com/timsly/carrierwave-serializable/pull/1 as the real reason was that the super was not correct since the patched methods would overwrite carrierwave's alias_methods for the read/write_uploader. I couldn't figure out an elegant/good solution to have the super in the patched method call carrierwaves default methods without possibly doing some sort of alias_method or rewriting the old methods and referencing them instead of super, so I just changed it so the calls will do what carrierwave is doing by calling read/write_attribute (https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/orm/activerecord.rb#L17)