2015-04-17 08:31:24 -04:00
|
|
|
require 'carrierwave/orm/activerecord'
|
|
|
|
|
|
|
|
class ProjectImportData < ActiveRecord::Base
|
|
|
|
belongs_to :project
|
2016-04-11 05:13:51 -04:00
|
|
|
attr_encrypted :credentials,
|
|
|
|
key: Gitlab::Application.secrets.db_key_base,
|
|
|
|
marshal: true,
|
|
|
|
encode: true,
|
|
|
|
mode: :per_attribute_iv_and_salt
|
2016-03-03 12:10:06 -05:00
|
|
|
|
2015-04-17 08:31:24 -04:00
|
|
|
serialize :data, JSON
|
|
|
|
|
|
|
|
validates :project, presence: true
|
2016-04-01 06:04:41 -04:00
|
|
|
|
2016-04-05 09:41:15 -04:00
|
|
|
before_validation :symbolize_credentials
|
|
|
|
|
|
|
|
def symbolize_credentials
|
2016-04-11 05:13:51 -04:00
|
|
|
# bang doesn't work here - attr_encrypted makes it not to work
|
2016-04-06 04:36:30 -04:00
|
|
|
self.credentials = self.credentials.deep_symbolize_keys unless self.credentials.blank?
|
2016-04-01 06:04:41 -04:00
|
|
|
end
|
2015-04-17 08:31:24 -04:00
|
|
|
end
|