2015-04-26 12:48:37 +05:30
|
|
|
require 'carrierwave/orm/activerecord'
|
|
|
|
|
|
|
|
class ProjectImportData < ActiveRecord::Base
|
|
|
|
belongs_to :project
|
2016-06-02 11:05:42 +05:30
|
|
|
attr_encrypted :credentials,
|
|
|
|
key: Gitlab::Application.secrets.db_key_base,
|
|
|
|
marshal: true,
|
|
|
|
encode: true,
|
|
|
|
mode: :per_attribute_iv_and_salt
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
serialize :data, JSON
|
|
|
|
|
|
|
|
validates :project, presence: true
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
before_validation :symbolize_credentials
|
|
|
|
|
|
|
|
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
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|