我有几个带有附件的模型
每个人都有不同的Uploader
我可以通过多态关联将上传器保存(装入)并用于不同模型的不同Uploader
文件吗?
例如
class User < ApplicationRecord
mount_uploader :avatar, AvatarUploader
has_many :attachments, as: :attachment
end
class Article < ApplicationRecord
mount_uploader :picture, PictureUploader
has_many :attachments, as: :attachment
end
class Attachment < ApplicationRecord
belongs_to :attachment, polymorphic: true
end
有可能吗?