brightin/brightcontent

View on GitHub
attachments/lib/brightcontent/attachments/attachable.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Brightcontent
  module Attachments
    module Attachable
      extend ActiveSupport::Concern

      included do
        add_brightcontent_column :attachments
        has_many :attachments, as: :attachable, dependent: :destroy, class_name: "Brightcontent::Attachment", inverse_of: :attachable
      end

      def attachment
        attachments.first
      end
    end
  end
end