Class: ReimbursementAttachment

Inherits:
ApplicationRecord show all
Defined in:
app/models/reimbursement_attachment.rb

Overview

Attachment for a given reimbursement

Instance Attribute Summary collapse

Belongs to collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes

Instance Attribute Details

#created_atDateTime

Returns:

  • (DateTime)


153
# File 'db/schema.rb', line 153

t.datetime "created_at"

#fileString

Returns:

  • (String)

Validations:



10
# File 'app/models/reimbursement_attachment.rb', line 10

validates :reimbursement, :title, :file, presence: true

#titleString

Returns:

  • (String)

Validations:



10
# File 'app/models/reimbursement_attachment.rb', line 10

validates :reimbursement, :title, :file, presence: true

#updated_atDateTime

Returns:

  • (DateTime)


154
# File 'db/schema.rb', line 154

t.datetime "updated_at"

Instance Method Details

#changed?boolean

Changed is ovewritten to avoid losing the already uploaded file when saving the reimbursement fails in some very specific situations

Returns:

  • (boolean)

    true if really changed or there is a cached file



20
21
22
# File 'app/models/reimbursement_attachment.rb', line 20

def changed?
  super || !file_cache.blank?
end

#reimbursementReimbursement

The associated reimbursement

Validations:



8
# File 'app/models/reimbursement_attachment.rb', line 8

belongs_to :reimbursement