Avoid RecordNotFound exception thrown by find method when invalid person_id
This commit is contained in:
parent
d084c708b6
commit
cc1add81b0
2 changed files with 7 additions and 1 deletions
|
|
@ -141,7 +141,7 @@ class PeopleController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def contacts
|
def contacts
|
||||||
@person = Person.find(params[:person_id])
|
@person = Person.find_by_id(params[:person_id])
|
||||||
if @person
|
if @person
|
||||||
@contact = current_user.contact_for(@person)
|
@contact = current_user.contact_for(@person)
|
||||||
@aspect = :profile
|
@aspect = :profile
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,12 @@ describe PeopleController do
|
||||||
assigns(:contacts_of_contact).should == contacts
|
assigns(:contacts_of_contact).should == contacts
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'shows an error when invalid person id' do
|
||||||
|
get :contacts, :person_id => 'foo'
|
||||||
|
flash[:error].should be_present
|
||||||
|
response.should redirect_to people_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#webfinger' do
|
describe '#webfinger' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue