diff options
author | James Lopez <james@jameslopez.es> | 2016-04-05 16:41:15 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-04-05 16:41:15 +0300 |
commit | 5e51fce4dcd62997f372aed44badc844f98851e9 (patch) | |
tree | 5599e0de61315e6274449c11c1fa011c91f8d749 /app/models/project_import_data.rb | |
parent | 850180aa393e2cfc124bb9687a123a196cff734c (diff) |
some refactoring to symbolise keys across importers and left a TODO
Diffstat (limited to 'app/models/project_import_data.rb')
-rw-r--r-- | app/models/project_import_data.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb index fa6055ff64d..225cbda15b1 100644 --- a/app/models/project_import_data.rb +++ b/app/models/project_import_data.rb @@ -18,7 +18,11 @@ class ProjectImportData < ActiveRecord::Base validates :project, presence: true - def stringified_credentials - JSON[credentials.to_json] + # TODO: This doesnt play well with attr_encrypted. Perhaps consider extending Marshall and specify a different Marshaller + before_validation :symbolize_credentials + + def symbolize_credentials + return if credentials.blank? + credentials.deep_symbolize_keys! end end |