画像を保存するためにcarrierwave_mongoidを追加しています。画像をmongoに保存しました。データは次のようになります。
 { "contentType" : "image/jpeg", "length" : 512659, "chunkSize" : 4194304, "uploadDate" : ISODate("2013-01-26T00:00:00Z"), "md5" : "3d44aa8fcfba7cae34fe9a592407410b", "filename" : "uploads/deal/image/295/15a11db8e441c610330af53a77e2b136.jpg", "_id" : 5 }
私はストーリーモデルを持っています:
class Deal
  include Mongoid::Document
  include Mongoid::Timestamps
  field :image,        :type => String
  field :status,       :type => Integer
  mount_uploader :image, ImageUploader
end
私のImageUploaderコードはここにあります:
class ImageUploader < CarrierWave::Uploader::Base
...
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end
end
今、私はmongodbから画像を表示したいのですが、私が持っているビューで
<%= image_tag(@deal.image.url)  %>
最後に、画像がビューに表示されず、次のエラーが発生します。
ActionController::RoutingError (No route matches [GET] "/assets/uploads/deal/image/295/15a11db8e441c610330af53a77e2b136.jpg"):
Carrierwave_mongoid を介して画像を読み取る方法を知りたい