傳回陣列,內含類別中所有附掛項目的反射物件。
來源: 顯示 | 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