diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-07-31 01:52:08 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:16 -0500 |
commit | a036e8561344866b072c2874906c9c9533cd27ea (patch) | |
tree | 4bfced891c9ece25baf5f2f644a4176d82b8b611 /app/models/account.rb | |
parent | a0ae00eeb5b89ccd23868e530608fbbc07349a7e (diff) |
[Feature] Add general-purpose account metadata to backend
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 7d19aac08..dab091bae 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -562,6 +562,8 @@ class Account < ApplicationRecord before_validation :prepare_username, on: :create before_destroy :clean_feed_manager + after_create_commit :set_metadata, if: :local? + private def prepare_contents @@ -605,4 +607,8 @@ class Account < ApplicationRecord end end end + + def set_metadata + self.metadata = AccountMetadata.new(account_id: id, fields: {}) if metadata.nil? + end end |