about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb5
-rw-r--r--app/models/user.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 8187bc7d9..d30c2a9ec 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -313,6 +313,10 @@ class Account < ApplicationRecord
     self[:also_known_as] || []
   end
 
+  def field
+    @field ||= fields.map { |f| [f.name, f.value] }.to_h
+  end
+
   def fields
     (self[:fields] || []).map { |f| Field.new(self, f) }
   end
@@ -352,6 +356,7 @@ class Account < ApplicationRecord
     self.fields = tmp
   end
 
+  # needs to be removed after migration
   def vars
     self[:vars]
   end
diff --git a/app/models/user.rb b/app/models/user.rb
index 5f1ffb595..6aafa124a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -38,6 +38,7 @@
 #  chosen_languages          :string           is an Array
 #  created_by_application_id :bigint(8)
 #  approved                  :boolean          default(TRUE), not null
+#  vars                      :jsonb            not null
 #
 
 class User < ApplicationRecord
@@ -151,6 +152,10 @@ class User < ApplicationRecord
   attr_reader :invite_code
   attr_writer :external
 
+  def vars
+    self[:vars]
+  end
+
   def confirmed?
     confirmed_at.present?
   end