Fix buggy associations
This commit is contained in:
@@ -19,8 +19,6 @@ class Comment < ActiveRecord::Base
|
||||
belongs_to :commentable, -> { with_hidden }, polymorphic: true, counter_cache: true
|
||||
belongs_to :user, -> { with_hidden }
|
||||
|
||||
has_many :votes, -> { for_comments }, foreign_key: 'votable_id'
|
||||
|
||||
before_save :calculate_confidence_score
|
||||
|
||||
scope :for_render, -> { with_hidden.includes(user: :organization) }
|
||||
|
||||
@@ -17,7 +17,6 @@ class Debate < ActiveRecord::Base
|
||||
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
|
||||
belongs_to :geozone
|
||||
has_many :comments, as: :commentable
|
||||
has_many :votes, -> { for_debates }, foreign_key: 'votable_id'
|
||||
|
||||
validates :title, presence: true
|
||||
validates :description, presence: true
|
||||
|
||||
@@ -19,7 +19,6 @@ class Proposal < ActiveRecord::Base
|
||||
belongs_to :geozone
|
||||
has_many :comments, as: :commentable
|
||||
has_many :proposal_notifications
|
||||
has_many :votes, -> { for_proposals }, foreign_key: 'votable_id'
|
||||
|
||||
validates :title, presence: true
|
||||
validates :question, presence: true
|
||||
|
||||
@@ -22,7 +22,7 @@ Debate:
|
||||
geozone: Geozone
|
||||
comments: [Comment]
|
||||
public_author: User
|
||||
votes: [Vote]
|
||||
votes_for: [Vote]
|
||||
tags: ["ActsAsTaggableOn::Tag"]
|
||||
Proposal:
|
||||
fields:
|
||||
@@ -45,7 +45,7 @@ Proposal:
|
||||
comments: [Comment]
|
||||
proposal_notifications: [ProposalNotification]
|
||||
public_author: User
|
||||
votes: [Vote]
|
||||
votes_for: [Vote]
|
||||
tags: ["ActsAsTaggableOn::Tag"]
|
||||
Comment:
|
||||
fields:
|
||||
@@ -60,7 +60,7 @@ Comment:
|
||||
ancestry: string
|
||||
confidence_score: integer
|
||||
public_author: User
|
||||
votes: [Vote]
|
||||
votes_for: [Vote]
|
||||
Geozone:
|
||||
fields:
|
||||
id: integer
|
||||
|
||||
Reference in New Issue
Block a user