[Git][noosfero/noosfero][master] article: ensure comments fetch considers polymorphic relation

Rodrigo Souto gitlab at mg.gitlab.com
Mon Dec 28 14:33:05 BRST 2015


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
dc825ac2 by Rodrigo Souto at 2015-12-28T13:24:59Z
article: ensure comments fetch considers polymorphic relation

- - - - -


1 changed file:

- app/models/article.rb


Changes:

=====================================
app/models/article.rb
=====================================
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -77,7 +77,7 @@ class Article < ActiveRecord::Base
   belongs_to :last_changed_by, :class_name => 'Person', :foreign_key => 'last_changed_by_id'
   belongs_to :created_by, :class_name => 'Person', :foreign_key => 'created_by_id'
 
-  has_many :comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :order => 'created_at asc'
+  has_many :comments, :class_name => 'Comment', :as => 'source', :dependent => :destroy, :order => 'created_at asc'
 
   has_many :article_categorizations, -> { where 'articles_categories.virtual = ?', false }
   has_many :categories, :through => :article_categorizations



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/dc825ac2e3440e55b35ce985a378c626988ac2f2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151228/bc69b7bb/attachment.html>


More information about the Noosfero-dev mailing list