Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hmis::File duplicate versions regression #4872

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions drivers/hmis/app/models/hmis/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# License detail: https://github.com/greenriver/hmis-warehouse/blob/production/LICENSE.md
###

class Hmis::File < GrdaWarehouse::File
class Hmis::File < GrdaWarehouseBase
self.table_name = :files
include ClientFileBase
include ::Hmis::Hud::Concerns::FormSubmittable

acts_as_paranoid
has_paper_trail(
meta: {
enrollment_id: :enrollment_id,
Expand All @@ -17,6 +20,12 @@ class Hmis::File < GrdaWarehouse::File

acts_as_taggable

# Need to set 'type' directly because we don't subclass GrdaWarehouse::File (because we needed to define has_paper_trail differently)
after_initialize :set_default_type, if: :new_record?
def set_default_type
self.type ||= self.class.sti_name
end

# These are not used, they're here so that we won't get an error trying to get/set the data source
attr_accessor :data_source_id
def data_source
Expand All @@ -28,8 +37,6 @@ def data_source
:date_updated,
].freeze

self.table_name = :files

belongs_to :enrollment, class_name: '::Hmis::Hud::Enrollment', optional: true
belongs_to :client, class_name: '::Hmis::Hud::Client'
belongs_to :user, class_name: 'Hmis::User', optional: true
Expand Down
Loading