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
def edit
@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
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
@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
@contacts = @contacts_in_aspect + @contacts_not_in_aspect
......
......@@ -36,7 +36,7 @@ class Conversation < ActiveRecord::Base
def first_unread_message(user)
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
......
......@@ -256,7 +256,7 @@ class User < ActiveRecord::Base
if aspect_ids == "all" || aspect_ids == :all
self.aspects
else
aspects.where(:id => aspect_ids)
aspects.where(:id => aspect_ids).to_a
end
end
......
......@@ -42,8 +42,6 @@ module User::Connecting
end
def remove_contact(contact, opts={:force => false, :retracted => false})
posts = contact.posts.all
if !contact.mutual? || opts[:force]
contact.destroy
elsif opts[:retracted]
......
......@@ -99,7 +99,7 @@ class PostInteractionPresenter
end
def as_api(collection)
collection.includes(:author => :profile).all.map do |element|
collection.includes(:author => :profile).map do |element|
element.as_api_response(:backbone)
end
end
......
......@@ -115,7 +115,7 @@ class Stream::Base
#
# @return [Array<Contact>]
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
# @param post [Post]
......
......@@ -23,8 +23,8 @@ describe 'deleteing your account' do
create_conversation_with_message(alice, @bob2.person, "Subject", "Hey @bob2")
#join tables
@users_sv = ShareVisibility.where(:contact_id => @bobs_contact_ids).all
@persons_sv = ShareVisibility.where(:contact_id => bob.person.contacts.map(&:id)).all
@users_sv = ShareVisibility.where(:contact_id => @bobs_contact_ids).load
@persons_sv = ShareVisibility.where(:contact_id => bob.person.contacts.map(&:id)).load
#user associated objects
@prefs = []
......@@ -86,8 +86,8 @@ describe 'deleteing your account' do
@bob2.contacts.should be_empty
end
it "clears the account fields" do
it "clears the account fields" do
@bob2.send(:clearable_fields).each do |field|
@bob2.reload[field].should be_blank
end
......@@ -99,7 +99,7 @@ describe 'deleteing your account' do
context 'remote person' do
before do
@person = remote_raphael
#contacts
@contacts = @person.contacts
......
......@@ -39,18 +39,18 @@ describe ShareVisibility do
end
it 'searches for share visibilies for all users contacts' do
contact_ids = alice.contacts.map{|c| c.id}
ShareVisibility.for_a_users_contacts(alice).should == ShareVisibility.where(:contact_id => contact_ids).all
contact_ids = alice.contacts.map(&:id)
ShareVisibility.for_a_users_contacts(alice).should == ShareVisibility.where(:contact_id => contact_ids).to_a
end
end
describe '.for_contacts_of_a_person' do
it 'searches for share visibilties generated by a person' do
contact_ids = alice.person.contacts.map{|c| c.id}
ShareVisibility.for_contacts_of_a_person(alice.person) == ShareVisibility.where(:contact_id => contact_ids).all
contact_ids = alice.person.contacts.map(&:id)
ShareVisibility.for_contacts_of_a_person(alice.person) == ShareVisibility.where(:contact_id => contact_ids).to_a
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