module Slices::HasAttachments::ClassMethods
Public Instance Methods
attachment_fields()
click to toggle source
# File lib/slices/has_attachments.rb, line 12 def attachment_fields @attachment_fields ||= if superclass.respond_to?(:attachment_fields) superclass.attachment_fields.dup else [] end end
has_attachments(embed_name = :attachments, options = {})
click to toggle source
# File lib/slices/has_attachments.rb, line 7 def has_attachments(embed_name = :attachments, options = {}) attachment_fields << embed_name embeds_many embed_name, {class_name: "Attachment", as: :object}.merge(options) end