mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Add join_table to enterprise groups relation
has_and_belongs_to_many relationships now require a join_table
This commit is contained in:
@@ -25,7 +25,8 @@ class Enterprise < ActiveRecord::Base
|
||||
has_many :relationships_as_child, class_name: 'EnterpriseRelationship',
|
||||
foreign_key: 'child_id',
|
||||
dependent: :destroy
|
||||
has_and_belongs_to_many :groups, class_name: 'EnterpriseGroup'
|
||||
has_and_belongs_to_many :groups, join_table: 'enterprise_groups_enterprises',
|
||||
class_name: 'EnterpriseGroup'
|
||||
has_many :producer_properties, foreign_key: 'producer_id'
|
||||
has_many :properties, through: :producer_properties
|
||||
has_many :supplied_products, class_name: 'Spree::Product',
|
||||
|
||||
@@ -5,7 +5,7 @@ class EnterpriseGroup < ActiveRecord::Base
|
||||
include PermalinkGenerator
|
||||
acts_as_list
|
||||
|
||||
has_and_belongs_to_many :enterprises
|
||||
has_and_belongs_to_many :enterprises, join_table: 'enterprise_groups_enterprises'
|
||||
belongs_to :owner, class_name: 'Spree::User', foreign_key: :owner_id, inverse_of: :owned_groups
|
||||
belongs_to :address, class_name: 'Spree::Address'
|
||||
accepts_nested_attributes_for :address
|
||||
|
||||
Reference in New Issue
Block a user