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

replace deprecated usages for all

parent cc8a614c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -70,12 +70,12 @@ class AspectsController < ApplicationController ...@@ -70,12 +70,12 @@ class AspectsController < ApplicationController
def edit def edit
@aspect = current_user.aspects.where(:id => params[:id]).includes(:contacts => {:person => :profile}).first @aspect = current_user.aspects.where(:id => params[:id]).includes(:contacts => {:person => :profile}).first
@contacts_in_aspect = @aspect.contacts.includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } @contacts_in_aspect = @aspect.contacts.includes(:aspect_memberships, :person => :profile).to_a.sort_by { |c| c.person.name }
c = Contact.arel_table c = Contact.arel_table
if @contacts_in_aspect.empty? if @contacts_in_aspect.empty?
@contacts_not_in_aspect = current_user.contacts.includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } @contacts_not_in_aspect = current_user.contacts.includes(:aspect_memberships, :person => :profile).to_a.sort_by { |c| c.person.name }
else else
@contacts_not_in_aspect = current_user.contacts.where(c[:id].not_in(@contacts_in_aspect.map(&:id))).includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } @contacts_not_in_aspect = current_user.contacts.where(c[:id].not_in(@contacts_in_aspect.map(&:id))).includes(:aspect_memberships, :person => :profile).to_a.sort_by { |c| c.person.name }
end end
@contacts = @contacts_in_aspect + @contacts_not_in_aspect @contacts = @contacts_in_aspect + @contacts_not_in_aspect
......
...@@ -36,7 +36,7 @@ class Conversation < ActiveRecord::Base ...@@ -36,7 +36,7 @@ class Conversation < ActiveRecord::Base
def first_unread_message(user) def first_unread_message(user)
if visibility = self.conversation_visibilities.where(:person_id => user.person.id).where('unread > 0').first if visibility = self.conversation_visibilities.where(:person_id => user.person.id).where('unread > 0').first
self.messages.all[-visibility.unread] self.messages.to_a[-visibility.unread]
end end
end end
......
...@@ -256,7 +256,7 @@ class User < ActiveRecord::Base ...@@ -256,7 +256,7 @@ class User < ActiveRecord::Base
if aspect_ids == "all" || aspect_ids == :all if aspect_ids == "all" || aspect_ids == :all
self.aspects self.aspects
else else
aspects.where(:id => aspect_ids) aspects.where(:id => aspect_ids).to_a
end end
end end
......
...@@ -42,8 +42,6 @@ module User::Connecting ...@@ -42,8 +42,6 @@ module User::Connecting
end end
def remove_contact(contact, opts={:force => false, :retracted => false}) def remove_contact(contact, opts={:force => false, :retracted => false})
posts = contact.posts.all
if !contact.mutual? || opts[:force] if !contact.mutual? || opts[:force]
contact.destroy contact.destroy
elsif opts[:retracted] elsif opts[:retracted]
......
...@@ -99,7 +99,7 @@ class PostInteractionPresenter ...@@ -99,7 +99,7 @@ class PostInteractionPresenter
end end
def as_api(collection) def as_api(collection)
collection.includes(:author => :profile).all.map do |element| collection.includes(:author => :profile).map do |element|
element.as_api_response(:backbone) element.as_api_response(:backbone)
end end
end end
......
...@@ -115,7 +115,7 @@ class Stream::Base ...@@ -115,7 +115,7 @@ class Stream::Base
# #
# @return [Array<Contact>] # @return [Array<Contact>]
def contacts_in_stream def contacts_in_stream
@contacts_in_stream ||= Contact.where(:user_id => user.id, :person_id => people.map{|x| x.id}).all @contacts_in_stream ||= Contact.where(:user_id => user.id, :person_id => people.map(&:id)).load
end end
# @param post [Post] # @param post [Post]
......
...@@ -23,8 +23,8 @@ describe 'deleteing your account' do ...@@ -23,8 +23,8 @@ describe 'deleteing your account' do
create_conversation_with_message(alice, @bob2.person, "Subject", "Hey @bob2") create_conversation_with_message(alice, @bob2.person, "Subject", "Hey @bob2")
#join tables #join tables
@users_sv = ShareVisibility.where(:contact_id => @bobs_contact_ids).all @users_sv = ShareVisibility.where(:contact_id => @bobs_contact_ids).load
@persons_sv = ShareVisibility.where(:contact_id => bob.person.contacts.map(&:id)).all @persons_sv = ShareVisibility.where(:contact_id => bob.person.contacts.map(&:id)).load
#user associated objects #user associated objects
@prefs = [] @prefs = []
...@@ -86,8 +86,8 @@ describe 'deleteing your account' do ...@@ -86,8 +86,8 @@ describe 'deleteing your account' do
@bob2.contacts.should be_empty @bob2.contacts.should be_empty
end end
it "clears the account fields" do it "clears the account fields" do
@bob2.send(:clearable_fields).each do |field| @bob2.send(:clearable_fields).each do |field|
@bob2.reload[field].should be_blank @bob2.reload[field].should be_blank
end end
...@@ -99,7 +99,7 @@ describe 'deleteing your account' do ...@@ -99,7 +99,7 @@ describe 'deleteing your account' do
context 'remote person' do context 'remote person' do
before do before do
@person = remote_raphael @person = remote_raphael
#contacts #contacts
@contacts = @person.contacts @contacts = @person.contacts
......
...@@ -39,18 +39,18 @@ describe ShareVisibility do ...@@ -39,18 +39,18 @@ describe ShareVisibility do
end end
it 'searches for share visibilies for all users contacts' do it 'searches for share visibilies for all users contacts' do
contact_ids = alice.contacts.map{|c| c.id} contact_ids = alice.contacts.map(&:id)
ShareVisibility.for_a_users_contacts(alice).should == ShareVisibility.where(:contact_id => contact_ids).all ShareVisibility.for_a_users_contacts(alice).should == ShareVisibility.where(:contact_id => contact_ids).to_a
end end
end end
describe '.for_contacts_of_a_person' do describe '.for_contacts_of_a_person' do
it 'searches for share visibilties generated by a person' do it 'searches for share visibilties generated by a person' do
contact_ids = alice.person.contacts.map{|c| c.id} contact_ids = alice.person.contacts.map(&:id)
ShareVisibility.for_contacts_of_a_person(alice.person) == ShareVisibility.where(:contact_id => contact_ids).all ShareVisibility.for_contacts_of_a_person(alice.person) == ShareVisibility.where(:contact_id => contact_ids).to_a
end end
end 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