Stop caching pet type images on item page
That's easy queries and easy templates!
This commit is contained in:
parent
b87492d4ee
commit
44341ba731
4 changed files with 4 additions and 15 deletions
|
@ -68,9 +68,8 @@ class ItemsController < ApplicationController
|
||||||
@contributors_with_counts = @item.contributors_with_counts
|
@contributors_with_counts = @item.contributors_with_counts
|
||||||
|
|
||||||
@supported_species_ids = @item.supported_species_ids
|
@supported_species_ids = @item.supported_species_ids
|
||||||
unless localized_fragment_exist?("items/show standard_species_images special_color=#{@item.special_color_id}")
|
@basic_colored_pet_types_by_species_id = PetType.special_color_or_basic(@item.special_color).
|
||||||
@basic_colored_pet_types_by_species_id = PetType.special_color_or_basic(@item.special_color).includes_child_translations.group_by(&:species)
|
includes_child_translations.group_by(&:species)
|
||||||
end
|
|
||||||
|
|
||||||
@trading_closet_hangers_by_owned = {
|
@trading_closet_hangers_by_owned = {
|
||||||
true => @item.closet_hangers.owned_trading.newest.includes(:user),
|
true => @item.closet_hangers.owned_trading.newest.includes(:user),
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
class PetTypeObserver < ActiveRecord::Observer
|
|
||||||
include FragmentExpiration
|
|
||||||
|
|
||||||
def after_create(pet_type)
|
|
||||||
images_key = "items/show standard_species_images special_color=#{pet_type.color_id}"
|
|
||||||
expire_fragment_in_all_locales(images_key)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -78,8 +78,6 @@
|
||||||
|
|
||||||
#item-preview
|
#item-preview
|
||||||
%ul#item-preview-species{'data-supported-species-ids' => @supported_species_ids.join(',')}
|
%ul#item-preview-species{'data-supported-species-ids' => @supported_species_ids.join(',')}
|
||||||
-# TODO: filter by compatibility
|
|
||||||
- localized_cache "items/show standard_species_images special_color=#{@item.special_color_id}" do
|
|
||||||
= standard_species_images_for(@basic_colored_pet_types_by_species_id)
|
= standard_species_images_for(@basic_colored_pet_types_by_species_id)
|
||||||
#item-preview-error
|
#item-preview-error
|
||||||
#item-preview-swf= t '.preview.requirements_not_met'
|
#item-preview-swf= t '.preview.requirements_not_met'
|
||||||
|
|
|
@ -14,7 +14,7 @@ module OpenneoImpressItems
|
||||||
|
|
||||||
# Activate observers that should always be running
|
# Activate observers that should always be running
|
||||||
config.active_record.observers = [:closet_hanger_observer,
|
config.active_record.observers = [:closet_hanger_observer,
|
||||||
:closet_list_observer, :pet_type_observer, :user_sweeper]
|
:closet_list_observer, :user_sweeper]
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
|
|
Loading…
Reference in a new issue