Fixing some stuff for Turbolinks, adding gzip on top, fixing a n+1 query

This commit is contained in:
Eugen Rochko
2016-03-25 15:09:40 +01:00
parent 36f3da3cde
commit 318886287b
7 changed files with 16 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class Status < ActiveRecord::Base
validates :text, presence: true, if: Proc.new { |s| s.local? && !s.reblog? }
scope :with_counters, -> { select('statuses.*, (select count(r.id) from statuses as r where r.reblog_of_id = statuses.id) as reblogs_count, (select count(f.id) from favourites as f where f.status_id = statuses.id) as favourites_count') }
scope :with_includes, -> { includes(:account, :mentions, reblog: [:account, :mentions], thread: [:account, :mentions]) }
scope :with_includes, -> { includes(:account, :mentions, :stream_entry, reblog: [:account, :mentions], thread: [:account, :mentions]) }
def local?
self.uri.nil?