Sha256: 2ac8233804206769be1b89689a9fcc76eefc0c799642dc65a6396b157a4882ac
Contents?: true
Size: 947 Bytes
Versions: 17
Compression:
Stored size: 947 Bytes
Contents
module Symphonia module Attachable extend ActiveSupport::Concern included do has_many :images, -> { order(:position) }, as: :attachable, dependent: :destroy, validate: false, class_name: 'Symphonia::Image' has_many :common_files, -> { order(:position) }, as: :attachable, dependent: :destroy, class_name: 'Symphonia::CommonFile' # validate do |container| # container.images.each do |img| # next if img.valid? # img.errors.full_messages.each do |msg| # errors.add(:base, "#{img.name}: #{msg}") # end # end # end def image_attachments=(form_images=[]) form_images.each do |attribute| self.images.build(attachment: attribute) end end def file_attachments=(form_files=[]) form_files.each do |attribute| self.common_files.build(attachment: attribute) end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems