noosfero | 2 new commits pushed to repository
Bráulio Bhavamitra
gitlab at gitlab.com
Mon Feb 23 16:42:39 BRT 2015
Bráulio Bhavamitra pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>
Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/cc833b499d5db047ae8012d8b07a038cc3b5fc85">cc833b49</a> by Braulio Bhavamitra
Use has_many through for favorite enterprises
- - - - -
<a href="https://gitlab.com/noosfero/noosfero/commit/52bd1adb939250bee8b3390f5fafd3d5b5a52ec4">52bd1adb</a> by Bráulio Bhavamitra
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
- - - - -
Changes:
=====================================
app/models/enterprise.rb
=====================================
--- a/app/models/enterprise.rb
+++ b/app/models/enterprise.rb
@@ -19,7 +19,8 @@ class Enterprise < Organization
has_many :inputs, :through => :products
has_many :production_costs, :as => :owner
- has_and_belongs_to_many :fans, :class_name => 'Person', :join_table => 'favorite_enteprises_people'
+ has_many :favorite_enterprise_people
+ has_many :fans, through: :favorite_enterprise_people, source: :person
def product_categories
ProductCategory.by_enterprise(self)
=====================================
app/models/favorite_enterprise_person.rb
=====================================
--- /dev/null
+++ b/app/models/favorite_enterprise_person.rb
@@ -0,0 +1,8 @@
+class FavoriteEnterprisePerson < ActiveRecord::Base
+
+ self.table_name = :favorite_enteprises_people
+
+ belongs_to :enterprise
+ belongs_to :person
+
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150223/a288ba65/attachment.html>
More information about the Noosfero-dev
mailing list