Proper ordering
This commit is contained in:
@@ -5,8 +5,10 @@ class BubblesController < ApplicationController
|
||||
if params[:tag_id]
|
||||
@tag = Tag.find(params[:tag_id])
|
||||
@bubbles = @tag.bubbles
|
||||
@most_active_bubbles = @tag.bubbles.left_joins(:comments, :boosts).group(:id).order(Arel.sql('COUNT(comments.id) + COUNT(boosts.id) DESC')).limit(10)
|
||||
else
|
||||
@bubbles = Bubble.all
|
||||
@bubbles = Bubble.all.order(created_at: :desc)
|
||||
@most_active_bubbles = Bubble.left_joins(:comments, :boosts).group(:id).order(Arel.sql('COUNT(comments.id) + COUNT(boosts.id) DESC')).limit(10)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
<% end %>
|
||||
|
||||
<section class="windshield flex-inline flex-wrap gap-half justify-center align-end">
|
||||
<%= render @bubbles.last(10) %>
|
||||
<% cache([@most_active_bubbles, 'stable_shuffle']) do %>
|
||||
<%= render @most_active_bubbles.sort_by { |bubble| Digest::MD5.hexdigest("#{bubble.id}#{@most_active_bubbles.cache_key}") } %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section class="bubbles-list unpad-inline center margin-block-start">
|
||||
|
||||
@@ -28,7 +28,7 @@ Rails.application.configure do
|
||||
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user