Stop caching latest contribution
That's another tiny query that I'm okay with just removing the cache overhead complexity for right now!
This commit is contained in:
parent
1bf84b5106
commit
cf2f78703b
3 changed files with 7 additions and 12 deletions
|
@ -69,10 +69,8 @@ class OutfitsController < ApplicationController
|
||||||
|
|
||||||
@species_count = Species.count
|
@species_count = Species.count
|
||||||
|
|
||||||
unless localized_fragment_exist?('outfits#new latest_contribution')
|
@latest_contribution = Contribution.recent.first
|
||||||
@latest_contribution = Contribution.recent.first
|
Contribution.preload_contributeds_and_parents([@latest_contribution].compact)
|
||||||
Contribution.preload_contributeds_and_parents([@latest_contribution].compact)
|
|
||||||
end
|
|
||||||
|
|
||||||
@neopets_usernames = user_signed_in? ? current_user.neopets_usernames : []
|
@neopets_usernames = user_signed_in? ? current_user.neopets_usernames : []
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ class ContributionObserver < ActiveRecord::Observer
|
||||||
include FragmentExpiration
|
include FragmentExpiration
|
||||||
|
|
||||||
def after_create(contribution)
|
def after_create(contribution)
|
||||||
expire_fragment_in_all_locales('outfits#new latest_contribution')
|
|
||||||
|
|
||||||
if contribution.contributed_type == 'SwfAsset'
|
if contribution.contributed_type == 'SwfAsset'
|
||||||
item = contribution.contributed.item
|
item = contribution.contributed.item
|
||||||
expire_fragment_in_all_locales("items/#{item.id} contributors")
|
expire_fragment_in_all_locales("items/#{item.id} contributors")
|
||||||
|
|
|
@ -92,12 +92,11 @@
|
||||||
required: true
|
required: true
|
||||||
= submit_tag t('.modeling_hub.load_pet.submit')
|
= submit_tag t('.modeling_hub.load_pet.submit')
|
||||||
|
|
||||||
- localized_cache 'outfits#new latest_contribution' do
|
- if @latest_contribution # will be nil for a fresh copy of the site ;P
|
||||||
- if @latest_contribution # will be nil for a fresh copy of the site ;P
|
#latest-contribution
|
||||||
#latest-contribution
|
= link_to t('.latest_contribution.header'), contributions_path, :id => 'recent-contributions-link'
|
||||||
= link_to t('.latest_contribution.header'), contributions_path, :id => 'recent-contributions-link'
|
= latest_contribution_description(@latest_contribution)
|
||||||
= latest_contribution_description(@latest_contribution)
|
%abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601}
|
||||||
%abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601}
|
|
||||||
|
|
||||||
#whats-new
|
#whats-new
|
||||||
- if @newest_unmodeled_items.present?
|
- if @newest_unmodeled_items.present?
|
||||||
|
|
Loading…
Reference in a new issue