跳至内容 跳至搜索
方法
R

实例公共方法

reflect_on_all_attachments()

返回类中所有附件的反射对象数组。

# File activestorage/lib/active_storage/reflection.rb, line 59
def reflect_on_all_attachments
  attachment_reflections.values
end

reflect_on_attachment(attachment)

返回名为 attachment 的附件的反射对象。

User.reflect_on_attachment(:avatar)
# => the avatar reflection
# File activestorage/lib/active_storage/reflection.rb, line 68
def reflect_on_attachment(attachment)
  attachment_reflections[attachment.to_s]
end