Skip to content
Extraits de code Groupes Projets
Valider 43315e14 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

sort contacts by name, not by a potentially nil field

parent 4ff67b02
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -104,7 +104,7 @@ class AspectsController < ApplicationController
def edit
@aspect = current_user.aspects.where(:id => params[:id]).includes(:contacts => {:person => :profile}).first
@contacts = current_user.contacts.includes(:person => :profile).all.sort!{|x, y| x.person.profile.first_name <=> y.person.profile.first_name }.reverse!
@contacts = current_user.contacts.includes(:person => :profile).all.sort!{|x, y| x.person.name <=> y.person.name}.reverse!
unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else
......
......@@ -287,6 +287,9 @@ describe AspectsController do
before do
@bob = bob
@eve = eve
@eve.profile.first_name = nil
@eve.profile.save
@eve.save
end
it 'renders' do
get :edit, :id => @alices_aspect_1.id
......@@ -297,7 +300,7 @@ describe AspectsController do
connect_users(@alice, @alices_aspect_1, @eve, @eve.aspects.first)
get :edit, :id => @alices_aspect_1.id
assigns[:contacts].should == [@alice.contact_for(@bob.person), @alice.contact_for(@eve.person)]
assigns[:contacts].should == [@alice.contact_for(@eve.person), @alice.contact_for(@bob.person)]
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