diff options
Diffstat (limited to 'app/models/customer_relations')
-rw-r--r-- | app/models/customer_relations/contact.rb | 3 | ||||
-rw-r--r-- | app/models/customer_relations/organization.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/app/models/customer_relations/contact.rb b/app/models/customer_relations/contact.rb index aaa7e2ae175..c632f8e2efa 100644 --- a/app/models/customer_relations/contact.rb +++ b/app/models/customer_relations/contact.rb @@ -5,8 +5,9 @@ class CustomerRelations::Contact < ApplicationRecord self.table_name = "customer_relations_contacts" - belongs_to :group, -> { where(type: 'Group') }, foreign_key: 'group_id' + belongs_to :group, -> { where(type: Group.sti_name) }, foreign_key: 'group_id' belongs_to :organization, optional: true + has_and_belongs_to_many :issues, join_table: :issue_customer_relations_contacts # rubocop: disable Rails/HasAndBelongsToMany strip_attributes! :phone, :first_name, :last_name diff --git a/app/models/customer_relations/organization.rb b/app/models/customer_relations/organization.rb index a18d3ab8148..c206d1e05f5 100644 --- a/app/models/customer_relations/organization.rb +++ b/app/models/customer_relations/organization.rb @@ -5,7 +5,7 @@ class CustomerRelations::Organization < ApplicationRecord self.table_name = "customer_relations_organizations" - belongs_to :group, -> { where(type: 'Group') }, foreign_key: 'group_id' + belongs_to :group, -> { where(type: Group.sti_name) }, foreign_key: 'group_id' strip_attributes! :name |