about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-06 12:34:39 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-06 12:34:39 +0100
commitaab330eb2d39711e19753e89ba7ff67521929cf0 (patch)
treea652e2dc7f3bbd67264f45bb9c7c010e149c03c8 /app/models
parentab80ebdeecf9410c5b43dde333b2e036e1198e24 (diff)
Adjusting design of public pages, optimizing account page queries
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 3ba58cc91..a346ac9b0 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -1,14 +1,14 @@
 class Status < ActiveRecord::Base
   belongs_to :account, inverse_of: :statuses
 
-  belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status'
-  belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status'
+  belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies
+  belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs
 
   has_one :stream_entry, as: :activity, dependent: :destroy
 
   has_many :favourites, inverse_of: :status, dependent: :destroy
-  has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status'
-  has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status'
+  has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblog
+  has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :thread
   has_many :mentioned_accounts, class_name: 'Mention', dependent: :destroy
 
   validates :account, presence: true