Commit 52bd1adb939250bee8b3390f5fafd3d5b5a52ec4
Exists in
master
and in
27 other branches
Merge branch 'favorite-has-many' into 'master'
Use has_many through for favorite enterprises This allow hooks for the joint model in the OpenGraphPlugin See merge request !382
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
app/models/enterprise.rb
... | ... | @@ -19,7 +19,8 @@ class Enterprise < Organization |
19 | 19 | has_many :inputs, :through => :products |
20 | 20 | has_many :production_costs, :as => :owner |
21 | 21 | |
22 | - has_and_belongs_to_many :fans, :class_name => 'Person', :join_table => 'favorite_enteprises_people' | |
22 | + has_many :favorite_enterprise_people | |
23 | + has_many :fans, through: :favorite_enterprise_people, source: :person | |
23 | 24 | |
24 | 25 | def product_categories |
25 | 26 | ProductCategory.by_enterprise(self) | ... | ... |