error is generated by Link.find - it raises exception if object was not found
you can simplify your code quite a bit:
def index
@link = Link.find_by_id(params[:id])
redirect_to(root_url, :notice => 'Record not found') unless @link
respond_to do |format|
format.html
end
end