This seems like it should be straightforward and work. MongoDB / BSON have a native binary type, and the Moped driver supports it. But when I try to create a scaffold in my rails project
rails g scaffold image png:binary source:string
I get this model:
class Image
include Mongoid::Document
field :png, type: Binary
field :source, type: String
end
which generates this error:
uninitialized constant Image::Binary
Using Rails 3.2.8 and Mongoid 3.0.9.
You will need to use the
Moped::BSON::Binarytype: