如何在Rails模型之间复制Refile附件?

时间:2016-02-09 11:36:50

标签: ruby-on-rails refile

我正在使用refile并且有两个模型:

class UserApplication < ActiveRecord::Base
  attachment :avatar
end

class User < ActiveRecord::Base
  attachment :avatar

  def from_application(application)
    # ...
    self.avatar = application.avatar
    # ...
  end
end

当我尝试从User设置UserApplication时,与avatar关联的UserApplication附件未与User一起保存。

如何将UserApplication#avatar复制或附加到User实例?

0 个答案:

没有答案