Commit cc833b499d5db047ae8012d8b07a038cc3b5fc85
1 parent
1843b53f
Exists in
master
and in
27 other branches
Use has_many through for favorite enterprises
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
app/models/enterprise.rb
... | ... | @@ -16,7 +16,8 @@ class Enterprise < Organization |
16 | 16 | has_many :inputs, :through => :products |
17 | 17 | has_many :production_costs, :as => :owner |
18 | 18 | |
19 | - has_and_belongs_to_many :fans, :class_name => 'Person', :join_table => 'favorite_enteprises_people' | |
19 | + has_many :favorite_enterprise_people | |
20 | + has_many :fans, through: :favorite_enterprise_people, source: :person | |
20 | 21 | |
21 | 22 | def product_categories |
22 | 23 | ProductCategory.by_enterprise(self) | ... | ... |