Class: ProjectImportData

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

Instance Method Summary collapse

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Method Details

#clear_credentialsObject


36
37
38
# File 'app/models/project_import_data.rb', line 36

def clear_credentials
  self.credentials = {}
end

#merge_credentials(hash) ⇒ Object


32
33
34
# File 'app/models/project_import_data.rb', line 32

def merge_credentials(hash)
  self.credentials = credentials.to_h.merge(hash) unless hash.empty?
end

#merge_data(hash) ⇒ Object


28
29
30
# File 'app/models/project_import_data.rb', line 28

def merge_data(hash)
  self.data = data.to_h.merge(hash) unless hash.empty?
end

#symbolize_credentialsObject


23
24
25
26
# File 'app/models/project_import_data.rb', line 23

def symbolize_credentials
  # bang doesn't work here - attr_encrypted makes it not to work
  self.credentials = self.credentials.deep_symbolize_keys unless self.credentials.blank?
end