Skip to content

Commit

Permalink
Merge pull request #3882 from akostadinov/tenant_id
Browse files Browse the repository at this point in the history
further associations tune-up
  • Loading branch information
akostadinov authored Sep 6, 2024
2 parents f39b1b2 + b55583e commit 1533335
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def schedule_backend_sync_worker
has_many :messages, -> { visible }, foreign_key: :sender_id, class_name: 'Message'
has_many :sent_messages, foreign_key: :sender_id, class_name: 'Message'

has_many :mail_dispatch_rules, dependent: :destroy
has_many :mail_dispatch_rules, dependent: :destroy, inverse_of: :account
has_many :system_operations, through: :mail_dispatch_rules

# Deleted received messages
Expand Down
2 changes: 0 additions & 2 deletions app/models/account_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ class AccountContract < Contract
alias account_plan plan
attr_reader :old_plan

belongs_to :user_account, class_name: 'Account', inverse_of: :bought_account_contract, autosave: false

# TODO: remove this when also Account states (pending, aproved ...) are handled on an
# account contract.
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/mail_dispatch_rule.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class MailDispatchRule < ApplicationRecord
belongs_to :account
belongs_to :account, inverse_of: :mail_dispatch_rules
belongs_to :system_operation

validates :account_id, :system_operation_id, presence: true
Expand Down

0 comments on commit 1533335

Please sign in to comment.