diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index c352adac..c54105d8 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -32,7 +32,7 @@ class ItemsController < ApplicationController respond_to do |format| format.html { unless localized_fragment_exist?('items#index newest_items') - @newest_items = Item.newest.with_translations.limit(18) + @newest_items = Item.newest.includes(:translations).limit(18) end } format.js { render :json => {:error => '$q required'}} @@ -102,7 +102,7 @@ class ItemsController < ApplicationController raise ActiveRecord::RecordNotFound, 'Pet type not found' end - @items = @pet_type.needed_items.with_translations. + @items = @pet_type.needed_items.includes(:translations). alphabetize_by_translations assign_closeted! diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 96fc329b..1f0e2bf6 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -48,7 +48,7 @@ class OutfitsController < ApplicationController unless localized_fragment_exist?('outfits#new newest_items') @newest_items = Item.newest.select([:id, :name, :thumbnail_url]). - with_translations.limit(9) + includes(:translations).limit(9) end unless localized_fragment_exist?('outfits#new latest_contribution') diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index b113f699..62f6fb39 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -10,7 +10,7 @@ class PetsController < ApplicationController redirect_to roulette_path else raise Pet::PetNotFound unless params[:name] - @pet = Pet.load(params[:name], :item_scope => Item.with_translations) + @pet = Pet.load(params[:name], :item_scope => Item.includes(:translations)) if user_signed_in? points = current_user.contribute! @pet else diff --git a/app/controllers/sitemap_controller.rb b/app/controllers/sitemap_controller.rb index 8b9fb8a4..d65708a4 100644 --- a/app/controllers/sitemap_controller.rb +++ b/app/controllers/sitemap_controller.rb @@ -3,7 +3,7 @@ class SitemapController < ApplicationController def index respond_to do |format| - format.xml { @items = Item.with_translations.sitemap } + format.xml { @items = Item.includes(:translations).sitemap } end end end diff --git a/app/models/pet.rb b/app/models/pet.rb index cc653d4f..a0d5d311 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -105,7 +105,7 @@ class Pet < ActiveRecord::Base last_pet_loaded = nil reloaded_pets = Parallel.map(candidates.keys, :in_threads => 8) do |locale| Rails.logger.info "Reloading #{name} in #{locale}" - reloaded_pet = Pet.load(name, :item_scope => Item.with_translations, + reloaded_pet = Pet.load(name, :item_scope => Item.includes(:translations), :locale => locale) Pet.connection_pool.with_connection { reloaded_pet.save! } last_pet_loaded = reloaded_pet