返回类中所有附件的反射对象数组。
来源: 显示 | GitHub
# File activestorage/lib/active_storage/reflection.rb, line 59 def reflect_on_all_attachments attachment_reflections.values end
返回名为 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