Skip to content
Extraits de code Groupes Projets
Valider 51e129b5 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Don't call hashes_for_people if it is a json request in search

parent dbf14529
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -14,7 +14,8 @@ class PeopleController < ApplicationController
limit = params[:limit] || 15
@people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => limit
@hashes = hashes_for_people(@people, @aspects)
@hashes = hashes_for_people(@people, @aspects) unless request.format == :json
#only do it if it is an email address
if params[:q].try(:match, Devise.email_regexp)
webfinger(params[:q])
......
......@@ -36,6 +36,14 @@ describe PeopleController do
get :index, :q => "Korth", :format => 'json'
response.body.should == [@korth].to_json
end
it 'does not set @hashes in a json request' do
get :index, :q => "Korth", :format => 'json'
assigns[:hashes].should be_nil
end
it 'sets @hashes in an html request' do
get :index, :q => "Korth"
assigns[:hashes].should_not be_nil
end
it "assigns people" do
eugene2 = Factory.create(:person,
:profile => Factory.build(:profile, :first_name => "Eugene",
......
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