【发布时间】:2019-06-06 20:21:47
【问题描述】:
例如我有模型
class User < ApplicationRecord
has_one_attached :avatar
has_one_attached :diploma
has_many_attached :photos
has_many_attached :files
end
如何获取某些型号的附件名称列表(分别用于has_one_attached 和has_many_attached)?
[:avatar, :diploma] 和 [:photos, :files] 在这种情况下。
【问题讨论】:
-
所以给定一个任意模型类
M,您想知道M的has_one_attached和has_many_attached名称吗? -
@muistooshort,是的。分别用于
has_one_attached和has_many_attached
标签: ruby-on-rails rails-activestorage