Commit 39c65602f384dc35377305b318ebfa71f6701b94

Authored by Leandro Santos
1 parent 1ae8dae3
Exists in staging and in 1 other branch production

looks for group_id only in comments table

db/schema.rb
... ... @@ -289,8 +289,12 @@ ActiveRecord::Schema.define(version: 20160422163123) do
289 289 t.string "user_agent"
290 290 t.string "referrer"
291 291 t.text "settings"
  292 + t.integer "paragraph_id"
  293 + t.string "paragraph_uuid"
  294 + t.integer "group_id"
292 295 end
293 296  
  297 + add_index "comments", ["paragraph_uuid"], name: "index_comments_on_paragraph_uuid", using: :btree
294 298 add_index "comments", ["source_id", "spam"], name: "index_comments_on_source_id_and_spam", using: :btree
295 299  
296 300 create_table "contact_lists", force: :cascade do |t|
... ...
plugins/comment_group/lib/ext/article.rb
... ... @@ -3,7 +3,7 @@ require_dependency 'article'
3 3 class Article
4 4  
5 5 has_many :group_comments, -> {
6   - order('created_at asc').where('group_id IS NOT NULL')
  6 + order('created_at asc').where('comments.group_id IS NOT NULL')
7 7 }, class_name: 'Comment', foreign_key: 'source_id', dependent: :destroy
8 8  
9 9 validate :not_empty_group_comments_removed
... ...