Upstream sync

This commit is contained in:
Senad Uka
2020-09-01 17:15:16 +02:00
parent 95a14ab2f6
commit f611382e9e
21 changed files with 107 additions and 53 deletions

View File

@@ -3,7 +3,7 @@ class MaterialRelease < ApplicationRecord
include Contractable
include Exploitable
include Notable
include Photoable
include Photoable # This association needs to be removed after changing the API. Removing it right now will cause failure in API specs.
include Releasable
include Searchable
include Signable
@@ -16,11 +16,11 @@ class MaterialRelease < ApplicationRecord
include SecondGuardianPhotoable
include GuardianName
include SecondGuardianName
include FilesFilterable
class << self
def custom_csv_exportable_headers
%i[name owner_info]
%i[name owner_info files_count]
end
end
@@ -56,6 +56,8 @@ class MaterialRelease < ApplicationRecord
%w[guardian_2_address_zip zip],
%w[guardian_2_address_country country]
]
has_many_attached :files
# We don't care for the argument but method WILL receive option name
# when called from inside with_option block, hence * argument
@@ -92,4 +94,8 @@ class MaterialRelease < ApplicationRecord
def uses_edl?
true
end
def files_count
files.any? ? files.size : I18n.t('material_releases.material_release.no_media')
end
end