Remove warning in aspectscontroller

This commit is contained in:
Raphael 2011-01-19 16:07:19 -08:00
parent 3c6dd3d721
commit ad48f4796c
2 changed files with 9 additions and 1 deletions

View file

@ -70,7 +70,11 @@ class AspectsController < ApplicationController
def show
@aspect = current_user.aspects.where(:id => params[:id]).first
redirect_to aspects_path('a_ids[]' => @aspect.id)
if @aspect
redirect_to aspects_path('a_ids[]' => @aspect.id)
else
redirect_to aspects_path
end
end
def edit

View file

@ -105,6 +105,10 @@ describe AspectsController do
get :show, 'id' => @aspect0.id.to_s
response.should be_redirect
end
it 'redirects on an invalid id' do
get :show, 'id' => 4341029835
response.should be_redirect
end
end
describe "#create" do