3

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

class UserApplication < ActiveRecord::Base
  attachment :avatar
end

class User < ActiveRecord::Base
  attachment :avatar

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

当我尝试设置Userfrom时,已关联UserApplication的附件未与 a 一起保存。avatarUserApplicationUser

如何复制或附加UserApplication#avatarUser实例?

4

0 回答 0