diff --git a/app/models/debate.rb b/app/models/debate.rb index 020259d80..13cff5b3f 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -13,6 +13,7 @@ class Debate < ActiveRecord::Base include ActsAsParanoidAliases belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' + belongs_to :public_author, -> { with_public_activity }, class_name: 'User', foreign_key: 'author_id' belongs_to :geozone has_many :comments, as: :commentable diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 1f9ede642..64cadbb24 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -14,7 +14,7 @@ class Proposal < ActiveRecord::Base RETIRE_OPTIONS = %w(duplicated started unfeasible done other) belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' - belongs_to :public_author, -> { public_activity }, class_name: 'User', foreign_key: 'author_id' + belongs_to :public_author, -> { with_public_activity }, class_name: 'User', foreign_key: 'author_id' belongs_to :geozone has_many :comments, as: :commentable has_many :proposal_notifications diff --git a/app/models/user.rb b/app/models/user.rb index c82ae3435..4952c286c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -54,7 +54,7 @@ class User < ActiveRecord::Base scope :by_document, -> (document_type, document_number) { where(document_type: document_type, document_number: document_number) } scope :email_digest, -> { where(email_digest: true) } scope :active, -> { where(erased_at: nil) } - scope :public_activity, -> { where(public_activity: true) } + scope :with_public_activity, -> { where(public_activity: true) } before_validation :clean_document_number