Sha256: c8d9362b4cbd889edd1f08e0f7192afe8e63cf2304cc2e381d1efffc001a1e9e

Contents?: true

Size: 444 Bytes

Versions: 6

Compression:

Stored size: 444 Bytes

Contents

module Gaku
  class Attachment < ApplicationRecord
    belongs_to :attachable, polymorphic: true, required: false

    has_attached_file :asset

    validates_associated :attachable, message: I18n.t(:'attachment.associated')

    validates :name, presence: true
    validates :asset, presence: true, on: :create
    do_not_validate_attachment_file_type :asset
    validates_attachment_presence :asset

    def to_s
      name
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gaku_core-0.3.0 app/models/gaku/attachment.rb
gaku_core-0.3.0.pre.4 app/models/gaku/attachment.rb
gaku_core-0.3.0.pre.3 app/models/gaku/attachment.rb
gaku_core-0.3.0.pre.2 app/models/gaku/attachment.rb
gaku_core-0.3.0.pre.1 app/models/gaku/attachment.rb
gaku_core-0.3.0.pre.0 app/models/gaku/attachment.rb