I was getting an error when calling as_json on a model, which under the hood calls serializable_hash. I'm currently using the master version of carrierwave specifically carrierwave 0.11.0 from git://github.com/carrierwaveuploader/carrierwave.git (at master@8ceadb7).
Thing.last.serializable_hash
NoMethodError: undefined method `uploader' for #<CarrierWave::Mounter:0x007f8ac9e13b50>
Did you mean? uploaders
from <snip>/carrierwave-mongoid-0.10.0/lib/carrierwave/mongoid.rb:100:in `block in serializable_hash'
from <snip>/carrierwave-mongoid-0.10.0/lib/carrierwave/mongoid.rb:98:in `each'
from <snip>/carrierwave-mongoid-0.10.0/lib/carrierwave/mongoid.rb:98:in `serializable_hash'
from (irb):4
I think what's happened is that carrierwave has added support for mount_uploaders (vs mount_uploader) that now supports an array of files, and under the hood changed a bunch of methods to support this. But I don't pretend to be an expert, just fixed my own version.
NB: This pull request changes the resulting behaviour from {"_id"=>..., "logo"=>{"url"=>"..."} } to {"_id"=>..., "logo"=>[{"url"=>"..."}] }
I was getting an error when calling
as_json
on a model, which under the hood callsserializable_hash
. I'm currently using the master version of carrierwave specificallycarrierwave 0.11.0 from git://github.com/carrierwaveuploader/carrierwave.git (at master@8ceadb7)
.I think what's happened is that carrierwave has added support for mount_uploaders (vs mount_uploader) that now supports an array of files, and under the hood changed a bunch of methods to support this. But I don't pretend to be an expert, just fixed my own version.
NB: This pull request changes the resulting behaviour from
{"_id"=>..., "logo"=>{"url"=>"..."} }
to{"_id"=>..., "logo"=>[{"url"=>"..."}] }