diff --git a/Gemfile b/Gemfile index fcd8ddf4..29198c44 100644 --- a/Gemfile +++ b/Gemfile @@ -48,6 +48,10 @@ gem "carrierwave", "~> 0.5.8" gem "parallel", "~> 0.5.17" +group :development do + gem "bullet", "~> 4.1.5" +end + group :development_async do # async wrappers gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git' diff --git a/Gemfile.lock b/Gemfile.lock index f0891775..d75e67b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,6 +86,8 @@ GEM arel (2.0.10) bcrypt-ruby (2.1.4) builder (2.1.2) + bullet (4.1.5) + uniform_notifier (~> 1.0.0) carrierwave (0.5.8) activesupport (~> 3.0) character-encodings (0.4.1) @@ -218,6 +220,7 @@ GEM polyglot polyglot (>= 0.3.1) tzinfo (0.3.31) + uniform_notifier (1.0.2) vegas (0.1.8) rack (>= 1.0.0) warden (1.0.6) @@ -235,6 +238,7 @@ PLATFORMS DEPENDENCIES RocketAMF! addressable + bullet (~> 4.1.5) carrierwave (~> 0.5.8) character-encodings (~> 0.4.1) compass (~> 0.10.1) diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 16ab7575..aac9c68f 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -12,7 +12,9 @@ class OutfitsController < ApplicationController def index if user_signed_in? - @outfits = current_user.outfits.wardrobe_order + @outfits = current_user.outfits. + includes(:item_outfit_relationships, {:pet_state => :pet_type}). + wardrobe_order respond_to do |format| format.html { render } format.json { render :json => @outfits } diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index dd6ca53c..e1f87339 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -13,7 +13,7 @@ module OutfitsHelper outfit = outfit_or_options end query = outfit.to_query - query << "&outfit=#{outfit.id}" if user_signed_in? && outfit.user == current_user + query << "&outfit=#{outfit.id}" if user_signed_in? && outfit.user_id == current_user.id link_to content, wardrobe_path(:anchor => query), options end diff --git a/app/models/outfit.rb b/app/models/outfit.rb index acde70cb..c2c2cbba 100644 --- a/app/models/outfit.rb +++ b/app/models/outfit.rb @@ -44,10 +44,12 @@ class Outfit < ActiveRecord::Base end def to_query + ids = self.worn_and_unworn_item_ids + { - :closet => closet_item_ids, + :closet => ids[:worn] + ids[:unworn], :color => color_id, - :objects => worn_item_ids, + :objects => ids[:worn], :species => species_id, :state => pet_state_id }.to_query diff --git a/config/initializers/bullet.rb b/config/initializers/bullet.rb new file mode 100644 index 00000000..524d6754 --- /dev/null +++ b/config/initializers/bullet.rb @@ -0,0 +1,5 @@ +if Rails.env.development? + Bullet.enable = true + Bullet.alert = true + Bullet.rails_logger = true +end diff --git a/vendor/cache/bullet-4.1.5.gem b/vendor/cache/bullet-4.1.5.gem new file mode 100644 index 00000000..2d675c0e Binary files /dev/null and b/vendor/cache/bullet-4.1.5.gem differ diff --git a/vendor/cache/uniform_notifier-1.0.2.gem b/vendor/cache/uniform_notifier-1.0.2.gem new file mode 100644 index 00000000..52b7e635 Binary files /dev/null and b/vendor/cache/uniform_notifier-1.0.2.gem differ