From a2ccf685ca3c21fd642640082baa39bbb8740a69 Mon Sep 17 00:00:00 2001 From: Steven Hancock Date: Wed, 13 Jun 2012 06:19:32 -0700 Subject: [PATCH 1/3] Update Rails to 3.2.6 --- Gemfile | 2 +- Gemfile.lock | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Gemfile b/Gemfile index 4e5061d4d..e1e6487d8 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'http://rubygems.org' gem 'bundler', '> 1.1.0' ruby '1.9.3' if ENV['HEROKU'] -gem 'rails', '3.2.5' +gem 'rails', '3.2.6' gem 'foreman', '0.46' diff --git a/Gemfile.lock b/Gemfile.lock index cbc5dd8af..2db66e19e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,12 +41,12 @@ GEM remote: http://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (3.2.5) - actionpack (= 3.2.5) + actionmailer (3.2.6) + actionpack (= 3.2.6) mail (~> 2.4.4) - actionpack (3.2.5) - activemodel (= 3.2.5) - activesupport (= 3.2.5) + actionpack (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.1) @@ -54,21 +54,21 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.1.3) - activemodel (3.2.5) - activesupport (= 3.2.5) + activemodel (3.2.6) + activesupport (= 3.2.6) builder (~> 3.0.0) - activerecord (3.2.5) - activemodel (= 3.2.5) - activesupport (= 3.2.5) + activerecord (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) arel (~> 3.0.2) tzinfo (~> 0.3.29) activerecord-import (0.2.9) activerecord (~> 3.0) activerecord (~> 3.0) - activeresource (3.2.5) - activemodel (= 3.2.5) - activesupport (= 3.2.5) - activesupport (3.2.5) + activeresource (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) + activesupport (3.2.6) i18n (~> 0.6) multi_json (~> 1.0) acts_as_api (0.4) @@ -320,14 +320,14 @@ GEM rack rack-test (0.6.1) rack (>= 1.0) - rails (3.2.5) - actionmailer (= 3.2.5) - actionpack (= 3.2.5) - activerecord (= 3.2.5) - activeresource (= 3.2.5) - activesupport (= 3.2.5) + rails (3.2.6) + actionmailer (= 3.2.6) + actionpack (= 3.2.6) + activerecord (= 3.2.6) + activeresource (= 3.2.6) + activesupport (= 3.2.6) bundler (~> 1.0) - railties (= 3.2.5) + railties (= 3.2.6) rails-i18n (0.6.4) i18n (~> 0.5) rails_admin (0.0.3) @@ -345,9 +345,9 @@ GEM sass-rails (~> 3.1) rails_autolink (1.0.9) rails (~> 3.1) - railties (3.2.5) - actionpack (= 3.2.5) - activesupport (= 3.2.5) + railties (3.2.6) + actionpack (= 3.2.6) + activesupport (= 3.2.6) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -525,7 +525,7 @@ DEPENDENCIES rack-piwik rack-rewrite (~> 1.2.1) rack-ssl - rails (= 3.2.5) + rails (= 3.2.6) rails-i18n rails_admin (~> 0.0.3) rails_autolink From 79b7d38158a3a7c290ae674384f2633758860599 Mon Sep 17 00:00:00 2001 From: Steven Hancock Date: Wed, 13 Jun 2012 14:18:09 -0700 Subject: [PATCH 2/3] Fix ActiveRecord queries with nested hashes Rails 3.2.6 doesn't like them --- app/models/contact.rb | 6 +++--- app/models/person.rb | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 6482e45a8..4a39d2a90 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -69,10 +69,10 @@ class Contact < ActiveRecord::Base def contacts people = Person.arel_table - incoming_aspects = Aspect.joins(:contacts).where( + incoming_aspects = Aspect.where( :user_id => self.person.owner_id, - :contacts_visible => true, - :contacts => {:person_id => self.user.person.id}).select('aspects.id') + :contacts_visible => true).joins(:contacts).where( + :contacts => {:person_id => self.user.person.id}).select('aspects.id') incoming_aspect_ids = incoming_aspects.map{|a| a.id} similar_contacts = Person.joins(:contacts => :aspect_memberships).where( :aspect_memberships => {:aspect_id => incoming_aspect_ids}).where(people[:id].not_eq(self.user.person.id)).select('DISTINCT people.*') diff --git a/app/models/person.rb b/app/models/person.rb index 416679c80..d8251c964 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -71,7 +71,8 @@ class Person < ActiveRecord::Base # @note user is passed in here defensively scope :all_from_aspects, lambda { |aspect_ids, user| joins(:contacts => :aspect_memberships). - where(:contacts => {:user_id => user.id}, :aspect_memberships => {:aspect_id => aspect_ids}) + where(:contacts => {:user_id => user.id}). + where(:aspect_memberships => {:aspect_id => aspect_ids}) } scope :unique_from_aspects, lambda{ |aspect_ids, user| @@ -81,7 +82,7 @@ class Person < ActiveRecord::Base #not defensive scope :in_aspects, lambda { |aspect_ids| joins(:contacts => :aspect_memberships). - where(:contacts => { :aspect_memberships => {:aspect_id => aspect_ids}}) + where(:aspect_memberships => {:aspect_id => aspect_ids}) } scope :profile_tagged_with, lambda{|tag_name| joins(:profile => :tags).where(:profile => {:tags => {:name => tag_name}}).where('profiles.searchable IS TRUE') } From 033e8e5cb638cf15fefa825af563063787fbe53b Mon Sep 17 00:00:00 2001 From: Steven Hancock Date: Wed, 13 Jun 2012 14:52:25 -0700 Subject: [PATCH 3/3] Fix ActiveRecord queries - take two --- app/models/person.rb | 2 +- app/models/tag_following.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index d8251c964..5e7fa9db2 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -85,7 +85,7 @@ class Person < ActiveRecord::Base where(:aspect_memberships => {:aspect_id => aspect_ids}) } - scope :profile_tagged_with, lambda{|tag_name| joins(:profile => :tags).where(:profile => {:tags => {:name => tag_name}}).where('profiles.searchable IS TRUE') } + scope :profile_tagged_with, lambda{|tag_name| joins(:profile => :tags).where(:tags => {:name => tag_name}).where('profiles.searchable IS TRUE') } scope :who_have_reshared_a_users_posts, lambda{|user| joins(:posts).where(:posts => {:root_guid => StatusMessage.guids_for_author(user.person), :type => 'Reshare'} ) diff --git a/app/models/tag_following.rb b/app/models/tag_following.rb index b47fbb973..915221856 100644 --- a/app/models/tag_following.rb +++ b/app/models/tag_following.rb @@ -5,7 +5,7 @@ class TagFollowing < ActiveRecord::Base validates_uniqueness_of :tag_id, :scope => :user_id def self.user_is_following?(user, tagname) - tagname.nil? ? false : joins(:tag).where(:tags => {:name => tagname.downcase}, :user_id => user.id).exists? + tagname.nil? ? false : joins(:tag).where(:tags => {:name => tagname.downcase}).where(:user_id => user.id).exists? end end