chore: Add Contact Note APIs (#3266)

This commit is contained in:
Sojan Jose
2021-10-24 12:40:30 +05:30
committed by GitHub
parent 19855a90e2
commit 06289b03ea
13 changed files with 191 additions and 15 deletions

View File

@@ -23,6 +23,7 @@
# fk_rails_... (user_id => users.id)
#
class Note < ApplicationRecord
before_validation :ensure_account_id
validates :content, presence: true
validates :account_id, presence: true
validates :contact_id, presence: true
@@ -31,4 +32,10 @@ class Note < ApplicationRecord
belongs_to :account
belongs_to :contact
belongs_to :user
private
def ensure_account_id
self.account_id = contact&.account_id
end
end