From 2f54d4f17de011865bbb7e10ad9997dbaa81f84e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonne=20Ha=C3=9F?= <me@mrzyx.de>
Date: Sat, 31 Aug 2013 14:11:08 +0200
Subject: [PATCH] remove conditions on association deprecation warnings

---
 app/models/conversation.rb | 2 +-
 app/models/user.rb         | 8 ++++----
 lib/diaspora/likeable.rb   | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/app/models/conversation.rb b/app/models/conversation.rb
index ae776cd543..c620efe534 100644
--- a/app/models/conversation.rb
+++ b/app/models/conversation.rb
@@ -10,7 +10,7 @@ class Conversation < ActiveRecord::Base
 
   has_many :conversation_visibilities, :dependent => :destroy
   has_many :participants, :class_name => 'Person', :through => :conversation_visibilities, :source => :person
-  has_many :messages, :order => 'created_at ASC'
+  has_many :messages, -> { order('created_at ASC') }
 
   belongs_to :author, :class_name => 'Person'
 
diff --git a/app/models/user.rb b/app/models/user.rb
index 61d61b299a..a37149603c 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -44,7 +44,7 @@ class User < ActiveRecord::Base
 
   has_many :invitations_from_me, :class_name => 'Invitation', :foreign_key => :sender_id
   has_many :invitations_to_me, :class_name => 'Invitation', :foreign_key => :recipient_id
-  has_many :aspects, :order => 'order_id ASC'
+  has_many :aspects, -> { order('order_id ASC') }
 
   belongs_to  :auto_follow_back_aspect, :class_name => 'Aspect'
   belongs_to :invited_by, :class_name => 'User'
@@ -59,13 +59,13 @@ class User < ActiveRecord::Base
   has_many :user_preferences
 
   has_many :tag_followings
-  has_many :followed_tags, :through => :tag_followings, :source => :tag, :order => 'tags.name'
+  has_many :followed_tags, -> { order('tags.name') }, :through => :tag_followings, :source => :tag
 
   has_many :blocks
   has_many :ignored_people, :through => :blocks, :source => :person
 
-  has_many :conversation_visibilities, through: :person, order: 'updated_at DESC'
-  has_many :conversations, through: :conversation_visibilities, order: 'updated_at DESC'
+  has_many :conversation_visibilities, -> { order 'updated_at DESC' }, through: :person
+  has_many :conversations, -> { order 'updated_at DESC' }, through: :conversation_visibilities
 
   has_many :notifications, :foreign_key => :recipient_id
 
diff --git a/lib/diaspora/likeable.rb b/lib/diaspora/likeable.rb
index 9e05c79b37..bbb84d2cea 100644
--- a/lib/diaspora/likeable.rb
+++ b/lib/diaspora/likeable.rb
@@ -6,15 +6,15 @@ module Diaspora
   module Likeable
     def self.included(model)
       model.instance_eval do
-        has_many :likes, :conditions => {:positive => true}, :dependent => :delete_all, :as => :target
-        has_many :dislikes, :conditions => {:positive => false}, :class_name => 'Like', :dependent => :delete_all, :as => :target
+        has_many :likes, -> { where(positive: true) }, dependent: :delete_all, as: :target
+        has_many :dislikes, -> { where(positive: false) }, class_name: 'Like', dependent: :delete_all, as: :target
       end
     end
 
     # @return [Integer]
     def update_likes_counter
-      self.class.where(:id => self.id).
-        update_all(:likes_count => self.likes.count)
+      self.class.where(id: self.id).
+        update_all(likes_count: self.likes.count)
     end
   end
 end
-- 
GitLab