如何在rails_admin中删除嵌入的文档图像?

时间:2013-11-15 17:38:31

标签: ruby-on-rails-3 mongoid carrierwave rails-admin

我目前正在使用Mongoid,CarrierWave和rails_admin。

由于某种原因,当我尝试从嵌入式文档中删除图像时,它永远不会被删除。我有什么想法可以尝试吗?这是我的模特:

class Quiz
  include Mongoid::Document

  embeds_many :rewards, cascade_callbacks: true
  accepts_nested_attributes_for :rewards
end


class Reward
  include Mongoid::Document

  embedded_in :quiz

  field :tagline,           type: String
  field :description,       type: String

  mount_uploader :picture, PictureUploader
end

我已经看过3年前的错误,但仍然无法解决这个问题?:

https://github.com/carrierwaveuploader/carrierwave/issues/81

1 个答案:

答案 0 :(得分:0)

万一有人还在寻找答案

accepts_nested_attributes_for :rewards, allow_destroy: true