Skip to content
Extraits de code Groupes Projets
Valider 2f54d4f1 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

remove conditions on association deprecation warnings

parent 89afb616
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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'
......
......@@ -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
......
......@@ -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
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter