Don't call hashes_for_people if it is a json request in search
This commit is contained in:
parent
dbf1452968
commit
51e129b5c6
2 changed files with 10 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue